Issue:
When creating a new Service Ticket using the API, Parts cannot be added in the Post for Service Tickets.
Resolution:
The API follows the same business rules as the application. You cannot add parts, appointments, notes, or other associated records until the ticket record exists in the database.
In the application you can see that the buttons for the associated records are all disabled until you save the ticket.
Once saved the other buttons are available.
The same is true with the API.
The status of the ticket needs to be In-Process so the status will need to be sent to set that status.
You would first Use the Post for service Tickets.
If the Post is successful, you will get the response back.
Now that the Service Ticket Exists the other part records for the ticket can be added.
Use the API endpoint for parts.
Use the ServiceTicketID from the response in the body of the Parts request.
If the Post is successful, you will get the 201 created response.
Below is a Json example of a Post for Service Tickets and for the Post for Service Ticket Parts.
{
"TicketStatus":"IP",
"CustomerId": 52334,
"CustomerNumber": "48977",
"CustomerSiteId": 59608,
"CustomerSiteBusinessName": "Elizabeth Arrington Beach House",
"CustomerSiteAddress": "4455 Beachside Blvd",
"CustomerSystemId": 115697,
"CustomerSystemAlarmAccount": "33 Use for Service",
"CustomerSystemCode": "CCTV",
"MultipleSystems": false,
"ProblemId": 12,
"ScheduledFor": "2023-05-16T08:00:00",
"EstimatedLength": 60,
"Billable": false,
"FieldComments": "",
"TripCharge": 25.0000,
"IsInspection": false,
"ServiceCompanyCode": "ABC Service Provider",
"PriorityDescription": "Medium",
"CategoryCode": "SVC Cont",
"ExpertiseLevel": 3,
"ServiceLevelCode": "T&M-Res",
"AutoNotify": "",
"CustomerBillId": 53361,
"CustomerBillBusinessName": "Elizabeth Arrington",
"CityState": "Daphne, AL"
}
{
"ServiceTicketId": 8387,
"PartId": 5555650,
"PartCode": "18Volt Battery",
"Quantity": 1.0,
"Rate": 18.0000,
"Location": "Testerton",
"WarehouseId": 61,
"WarehouseCode": "Daphne",
"Description": "18Volt Battery",
"TaxExempt": false
}
To Review the full model for Service Tickets and Service Ticket Parts see the online help for SedonaCloud API.
You can see the documentation at the URL below.
If you are currently using SedonaCloud2.0 the documentation is available from your site under the About page.