When updating an order, location, customer, or any other data through the OnTime API, any field that is not included in the update request will be nullified (i.e. made blank or erased).
For example, consider the following pre-existing zone as an object within OnTime:
{
"ID": "26bb737e-2fd4-420f-964a-69ca39f1fce9",
"Name": "Dallas North",
"PostalCodes": "75001, 75043, 75080"
}
If a request is sent to update fields within this zone, any fields not included in the request will have their data nullified:
Request
REST API: POST /api/zone/post
{
"ID": "26bb737e-2fd4-420f-964a-69ca39f1fce9",
"Name": "Dallas Northwest"
}
Response
REST API: POST /api/zone/post
{
"ID": "26bb737e-2fd4-420f-964a-69ca39f1fce9",
"Name": "Dallas North",
"PostalCodes": ""
}
As a result of this update, the PostalCodes field has had its data erased. To ensure that no data is lost during an update, all non-empty fields must be included in the update request, as shown below:
REST API: POST /api/zone/post
{
"ID": "26bb737e-2fd4-420f-964a-69ca39f1fce9",
"Name": "Dallas Northwest",
"PostalCodes": "75001, 75043, 75080"
}