All Collections
Uptick API
Uptick API - Status Transitions
Uptick API - Status Transitions
Aleks Petrovic avatar
Written by Aleks Petrovic
Updated over a week ago

The Uptick API provides a /transition/ endpoint that allows appointments, service quotes, defect quotes, and purchase orders to be transitioned from one status to another programmatically.

The transition options will be dependent on the current status of the item. For example, a service quote with a status currently set to APPROVED will have the transition options of reverting to draft, completing, or voiding.

Identify the Available Transition Options

In order to identify the available transition options, you will need the base API endpoint and the ID of the item you wish to transition. An example is provided below:

https://<workspace>.onuptick.com/api/v2.11/servicequotes/1420/

Next, perform a GET request to the /transition/ endpoint for the given item. An example is provided below:

curl --location 'https://<workspace>.onuptick.com/api/v2.11/servicequotes/1420/transition/' \
--header 'Authorization: Bearer <token>' \
--data ''

The JSON response will include the list of available transitions based on the current status of the item. An example JSON response is included below:

[
{
"name": "revert_draft",
"source": "APPROVED",
"target": "DRAFT",
"custom": {
"verbose": "Revert to draft",
"order": 8
}
},
{
"name": "complete",
"source": "APPROVED",
"target": "COMPLETED",
"custom": {
"verbose": "Complete",
"confirmation_required": true,
"confirmation_description": "This will create outcomes as required: Property, Client, Task. Included Service start dates will be set to the approval date.",
"order": 9
}
},
{
"name": "void",
"source": "*",
"target": "VOIDED",
"custom": {
"verbose": "Void",
"order": 10,
"confirmation_required": true,
"confirmation_message": "Are you sure you want to void this service quote?"
}
}
]

Transition an Appointment, Service Quote, Defect Quote, or Purchase Order

Once the transition options have been identified and the target status chosen, a PATCH request can be sent to the same transition endpoint. The name of the transition will need to be included in the body of the PATCH request. An example request is provided below:

curl --location --request PATCH 'https://<workspace>.onuptick.com/api/v2.11/servicequotes/1420/transition/' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <token>' \
--data '{"transition": "complete"}'

Once the transition has been successfully processed, a 200 response will be sent back with the item in the body of the response. An example response is provided below:

{
"status": "OK",
"servicequote": {
"id": 1420,
"created": "2024-03-08T09:30:33.351219+11:00",
"updated": "2024-04-09T13:29:17.154133+10:00",
"uuid": "f1c0a226-8ddb-483d-ad1f-e66ea4eaadc8",
"ref": "SQ-0076",
"status": "COMPLETED",
"status_changed_submitted": "2024-03-08T09:31:50.209122+11:00",
...
}
}
Did this answer your question?