Update Zendesk User - Where did I go wrong?

I went through quite some trial and error (403 and 422 specifically) to fire a successful PUT request to the Zendesk API. While I thought I got the hang of it, because the requests to our own API (all POST and GET) were done so easily.

Here's what I ended up with:

linkCustomer: function(customer_id) { var data = '{ "user": { "external_id": ' + customer_id + ' } }'; return { url: '/api/v2/users/' + this.ticket().requester().id() +'.json', type: 'PUT', data: data, dataType: 'json', contentType: 'application/json; charset=UTF-8', processData: false }; }

With a POST request to an own API (through the proxy) the data object seemed to be parsed to JSON automatically. With this PUT request to the Zenddesk API I had to pass the JSON object as a string.

One of my other calls looks like this:

getCustomer: function(external_id) { return { url: 'http://www.domain.com/zendesk/api/getCustomer', type: 'POST', data: { customer_id: external_id }, dataType: 'json' }; }


So the code I started my trial and error with looked somewhat like the code below. But gave me a 403 error, until I added the contentType parameter. Which gave me the 422 error, until i passed the JSON as a string and set the processData parameter to false.

linkCustomer: function(customer_id) { return { url: '/api/v2/users/' + this.ticket().requester().id() +'.json', type: 'PUT', data: { user: { customer_id: external_id } }, dataType: 'json' }; }


So that makes me believe the code I ended up with is incorrect (although it's functional correct). Could somebody point me in the right direction?


  • 0

    There's an entry in the list of known issues about 403s for POST s, PUT s, and DELETE s to your own help desk. We hope to have it resolved soon. Once it is, your last example ( data as JavaScript objects, no contentType , no processData: false ) should work fine.

  • 0

    Hey James,

    I forgot to mention that I've read about that, but it was only mentioning about PUT and DELETE through the proxy.

    Thanks for the answer, I'll stick with the current solution for now.



Please sign in to leave a comment.