It's all about the answers!

Ask a question

Jazz.net repo REST JSON request for query list returning 406 response


Aaron Allsbrook (71257) | asked Oct 29 '12, 1:44 p.m.
edited Oct 30 '12, 12:00 p.m. by Seth Packham (1.4k42213)
 Hi All,

I am making a call to get all queries associated with a particular project.  Using this as a reference https://jazz.net/wiki/bin/view/Main/ResourceOrientedWorkItemAPIv2#Examples_AN2

The request for all queries defined against the project area RTC looks like
https://jazz.net/jazz/oslc/queries.json?oslc_cm.query=rtc_cm%3AprojectArea%3D%22_1w8aQEmJEduIY7C8B09Hyw%22

This pattern URL works fine for my RTC 3.0. and RTC 4.0 server environments but jazz.net gives me back a 406 as the response.  In the browser it returns a paged xml response of all possible queries even though json was requested.

Anyone have an idea on what might up with this?  Am I doing something wrong?

One answer



permanent link
Curtis d'Entremont (1.3k3) | answered Oct 30 '12, 11:36 a.m.
FORUM MODERATOR / JAZZ DEVELOPER
Status code 406 (Not Acceptable) is described here:
http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html

To summarize, the server is saying "I don't have any content types to give you that you would find acceptable". When a client makes a request, they should supply an "Accept" header to tell the server what content types (response formats) it can handle. The server then goes through the list until it finds one it knows how to write, and sends it. Here, either you didn't supply an Accept header, or the service isn't familiar with any of the content types you provided.

Comments
Aaron Allsbrook commented Oct 30 '12, 1:14 p.m.

Hi Curtis,


Thanks for the reply, I think I understand what the 406 is saying.  My request does expect a JSON response and for my production RTC and test RTC instances this request responds correctly.  For jazz.net the response is just completely empty.  I am curious as to why the jazz.net repository doesn't respond like other servers.  Is there something strange in the architecture that I can work around?

are you able to browse the above query in a browser and get a response?


Curtis d'Entremont commented Oct 30 '12, 1:31 p.m.
FORUM MODERATOR / JAZZ DEVELOPER

Yes, I can get an XML response if I open the URL directly. However if I craft my own request with an Accept header for JSON, I get back a 500 Internal Server Error describing an error running the query, so it sounds like there is a bug in the service. I reported the bug here: OSLC query fails to return JSON on jazz.net (239073).

I can't reproduce the 406 error you're seeing.

Your answer


Register or to post your answer.


Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.