Problem calling API

  • 3 April 2015
  • 4 replies
  • 22 views

Trying to update a Change ticket through the api, but if I try to update a custom field, I'm just getting a 500 error (as someone else mentioned, more error info would be a huge help - "It Is Broken" is useless).


If I do a PUT request, but not include the custom fields, it works fine:


curl -u <myaccessID>:nopass -H "Content-Type: tion/json" -X PUT -d '{"itil_change":{"subject":"test only - please ignore!!!!"}}' http://mycompany.freshservice.com/itil/changes/86.json


But if I include the custom fields, I get the 500 error:


curl -u <myaccessID>:nopass -H "Content-Type: tion/json" -X PUT -d '{"itil_change":{"subject":"test only - please ignore!!!!","custom_field_values":{"tfs_backlog_link_6513":"www.google.com"}}}' http://mycompany.freshservice.com/itil/changes/86.json


Anyone?


(Yes, I emailed support, but figured I'd try here too)


Thanks.


This topic has been closed for comments

4 replies

Hi John,


Can you try using "custom_field_attributes" instead of "custom_field_values" in the API call?


Thanks.


Yes, I did figure out that to UPDATE and add a custom field value, I need to use custom_field_attributes, NOT custom_field_values.


Why are they two different keys - custom_field_values in the result for a GET, and custom_field_attributes for a PUT? That makes no sense!


Hi John,


Yes it is very confusing to have 2 different keys in the API. We will be fixing this in a couple of weeks time and making sure that the keys in the GET response and in the PUT request match. I'll keep you updated.


Userlevel 4
Badge +5

Hi John,




We have updated the API documentation to include custom_field_attributes. We are sorry for not notifying earlier on this update.




Please write to support@freshservice.com for further assistance.