Issue updating open tickets using API

I'm trying to update all our tickets where a custom field, serial number is filled in with information from our ERP system. 

However we also have some custom ticket fields that are required when closing a ticket. 

And if i try to update a ticket where these values are not yet filled in, i get the following error: 

{"description":"Validation failed","errors":[{"field":"custom_fields.cf_category","message":"It should be one of these values: 'x,y,z'","code":"invalid_value"},{"field":"custom_fields.cf_question_about","message":"It should be one of these values: 'x,y,z'","code":"invalid_value"},{"field":"custom_fields.cf_source","message":"It should be one of these values: 'x,y,z'","code":"invalid_value"}]}

Example CURL request: 

 curl -v -u -H "Content-Type: application/json" -X PUT -d '{"custom_fields":{"cf_machine_type":"XXX","cf_invoice_number":1000,"cf_invoice_date":"2018-01-01"}}' ''

Am i doing something wrong here?


Welcome to the Freshdesk community. I'd suggest you read this to know how you can get the best out of the community.

Thanks for the detailed note on the API error that you've encountered. If you're just trying to update these tickets and not close them (change the status to 'Closed/Resolved'), it should work as expected. When it comes to ticket fields and their settings, there are two options to choose from: 

1. Making the field mandatory when the agents update the form

2. Making the field mandatory when the agents try to close the ticket

Can you please check if option(1) has been enabled for these custom fields? It might be the reason why you aren't able to update tickets without filling in the required information.


Thanks for the reply, however i've checked the fields and only "Required when closing" is active: 


I'm not trying to update the status of the tickets, only the custom fields. 

When i try to manually update these ticket fields from the web interface, i have no issues. 


Given the error message, can you please check if you're passing the right values in the API call? All these fields seem to be dropdowns and so you might have to use any of the pre-filled options in your API query.


The fields i'm updating are either text or date fields: 


I've just tried updating only the machine field using the following cURL request and i get the same error: 

 curl -v -u -H "Content-Type: application/json" -X PUT -d '{"custom_fields":{"cf_machine_type":"XXX"}}' ''


Can you please try updating the date field with the values in this format? 



Same error when i update the machine field with a string or the date field as seen below: 


Found the issue, the tickets giving the error were closed tickets where the custom fields required upon closing weren't filled in. 

As the requirement to fill in those custom fields was only recently added, this affected most tickets. 

Thanks for the help in troubleshooting!

Login or Signup to post a comment