Issue:
When trying to update a Service Ticket Dispatch record using the API, the dispatch can no longer be viewed in the SedonaOffice application.
Sending the package below using the PUT for Service Ticket Dispatch results in the dispatch not showing on the service ticket in SedonaOffice.
{
"ServiceTicketId": 8702,
"ServiceTechId": 92,
"ScheduleTime": "2024-08-22T12:30:00"
}
Resolution:
When using the PUT verb, the full resource should be sent not just the fields you wish to change.
The PUT is used to modify the entire resource. The PUT requires the full resource to be sent to not corrupt the existing record. You would send the full resource with the changes needed. So to add a new tech to the dispatch you would send everything and the new tech ID to replace the existing data.
{
"DispatchId": 4180,
"ServiceTicketId": 8702,
"TicketStatus": "IP",
"ServiceTechId": 93,
"ScheduleTime": "2024-08-22T12:30:00",
"DispatchTime": "1899-12-30T00:00:00",
"ArrivalTime": "1899-12-30T00:00:00",
"DepartureTime": "1899-12-30T00:00:00",
"EstimatedLength": 60,
"ResolutionId": 1,
"ResolutionCode": "N/A",
"Signature": null,
"ResolvesTicket": false,
"IsGoBack": false,
"UserCode": "WebSvcs",
"EditTimestamp": "2024-08-22T14:42:23.827",
"Noteid": 1,
"Notes": "",
"RegisterId": 1,
"RegisterNumber": 0,
"Signer": "",
"FSUNoSignerAvailable": false,
"SendToFSU": 0,
"Holiday": false,
"Overtime": false,
"IsFirm": false,
"FirstName": "",
"LastName": "",
"ServiceTicket": {},
"ServiceTicketNotes": null
}
The verb PATCH is used to apply a partial modification to a resource. The PATCH only updates the data that you send in the record. The PATCH can save you some bandwidth, as updating a field with PATCH means less data being transferred than sending the whole record with PUT.
We do not currently use the PATCH so the full record should be sent to update a record.