1

JSON/REST, POST organizations.json 406 not acceptable

I'm having problems with the creation of organizations via the rest api. I am getting the http status of "406 Not Acceptable"

I have tried a number of differnet json strings as the postdata, and followed some instruction from zendesk support, but unfortunately am still having problems.

 

I am using "Content-Type: application/json' in the header, and autheniticating correctly. the same curl config works for creating users and some other calls i have setup in my code. testing from the command line yeilds the same results.

 

The funny thng about it is that even though "406 Not Acceptable" is returned, the organization is created, and all options i specify are set. so it appears to "work"

here is the curl output

[darknoise@enclave md-zendesk]$ curl -v -H "Content-Type: application/json" -u XXX:XXX -X POST http://xxxx.zendesk.com/organizations.json -d "{\"organization\": {\"name\": \"Test\",\"is_shared\": false}}"
* About to connect() to xxxx.zendesk.com port 80 (#0)
* Trying 184.106.12.184... connected
* Connected to xxxx.zendesk.com (184.106.12.184) port 80 (#0)
* Server auth using Basic with user 'XXX'

POST /organizations.json HTTP/1.1
Authorization: Basic XXX
User-Agent: curl/7.21.2 (x86_64-unknown-linux-gnu) libcurl/7.21.2 OpenSSL/1.0.0a zlib/1.2.5
Host: xxxx.zendesk.com
Accept: */*
Content-Type: application/json
Content-Length: 57

< HTTP/1.1 406 Not Acceptable
< Server: nginx/0.6.35
< Date: Thu, 18 Nov 2010 02:01:29 GMT
< Content-Type: text/html; charset=utf-8
< Transfer-Encoding: chunked
< Connection: keep-alive
< Status: 406 Not Acceptable
< P3P: CP="NOI DSP COR NID ADMa OPTa OUR NOR"
< X-Runtime: 31
< Set-Cookie: _zendesk_session=XXX; path=/; HttpOnly
< Set-Cookie: zendesk_user_version=users%2F19172715-20101113123904; path=/
< Cache-Control: no-cache
<
* Connection #0 to host xxxx.zendesk.com left intact
* Closing connection #0

5 comments

  • 0

    Anyone have decision for this mistake. I tried to use various content-types, but I have the same problem.

     

  • 0

    Our organizations API is not responding to JSON POST requests properly.  A workaround for now is to actually pass .xml on the end of the API request like below.  Note the .xml passed on the end of the controller, but with JSON header and body:

    curl -u username@domain.com:password http://steven.zendesk.com/organizations.xml -X POST -H "Content-Type:application/json" -d "{\"organization\":{\"name\":\"Test2\", \"is_shared\":false}}" -v

    We'll make sure we fix the creation via JSON to behave as expected.

  • 0

    @Steven -  Is there any update on this issue?  Is this still on a workaround or a fix is already available?

     

    Thanks.

    Nambi

  • 0

    Nambi, this has yet to be worked on, sorry for the delay.

  • 0

    Nambi, it looks like I spoke too soon. We have been doing some versioning and refactoring work on our API and it looks like this is now fixed.

Please sign in to leave a comment.