We are trying to use Zendesk tickets to track fraud costs in our organization. I have three custom fields "attempted", "recovered", and "loss". Evidently Zendesk will not perform the calculation internally, so I am using the ticket API to retrieve the values, perform the calculation (attempt - recovery = loss), and then use the ticket API to update the "loss" custom field with the value.
I am using the following API according to the documentation, but it is not populating the custom field with the new value.
put https://{domain name}.zendesk.com/api/v2/tickets/{ticket number}.json -v -u {username}/token:{API Key} -H "Content-Type: application/json" -d '{ "ticket": {"custom fields": [{"id": 360048278251, "value": 999}]}}'
The output from this statement seems to be the original ticket values and not the updated values. When I look at the ticket in Zendesk this field is not updated.
How do I update/change the custom field in a ticket?


You'll want to write a script that after listing all of the ticket field options > loops through the options and pops them into a new array of objects for the ones you'd like to keep > then add in the new ones into the cleaned array. Finally use the update ticket field api to update the field.
Hope this helps,