Cannot access custom_fields to update a ticket

  • 25 July 2018
  • 1 reply
  • 44 views

Hi there! I've been using curl POST and PUT to update certain elements of a ticket once they have been created. This seems to work for all fields like priority, status, etc but I cannot, for the life of me, access the custom_fields. We have a custom field called orderid, and it throws the following error 


"Request body has invalid json format"


this works:


'{ "priority":1}'


these do not work (i have tried a ton of different combinations):

'{ "priority":1, "custom_fields" :{ "orderid":1234} }'

'{ "custom_fields" : {"orderid":1234} }'


what is the problem? I can't find an answer online, but i know for a fact that these are valid json objects and these are the correct name for my custom fields. thank you!





This topic has been closed for comments

1 reply

Userlevel 4
Badge +12

Hello Ricardo,


The custom fields would be prefixed with cf before the actual field name. Here's a sample of the fields configured in my test instance:


{"id":35000725087,"name":"cf_code","label":"code","description":"","position":5,"required_for_closure":true,"required_for_agents":false,"type":"custom_number","default":false,"customers_can_edit":true,"label_for_customers":"code"}


You can obtain the name value for the fields setup in your instance by accessing the List all ticket fields endpoint.


Cheers!