It's all about the answers!

Ask a question

Getting Json response using the REST client


Ranjith Parameswaran (12311215) | asked Jul 05 '12, 8:27 a.m.
retagged Jul 09 '12, 7:18 a.m. by Pramod Chandoria (2.1k11220)


Hello,

 

I was using the rest add-on in mozilla and was working with the article "How to consume the Rational Team Concert change management service", but every time i create a header to get response in json format i get an error "Status Code: 406 Not Acceptable".

 

Can i get guidance on how to get a json response. Thanks in advance

 

 

7 answers



permanent link
Curtis d'Entremont (1.3k3) | answered Jul 05 '12, 10:27 a.m.
FORUM MODERATOR / JAZZ DEVELOPER
This status code is usually used to indicate that you either didn't send an Accept header, or its value didn't match any of the available output formats of the resource. In plain English, either you didn't say what format you wanted or it doesn't have the one you asked for. Try sending a "Accept: application/json" header in your request.

Comments
Ranjith Parameswaran commented Jul 05 '12, 11:23 a.m.

Hello Curtis,

Thanks for the answer. I had added the accept header as mentioned above "Accept: application/json" .Everytime i add this header the response would be in the form "Status Code: 406 Not Acceptable".

if i remove the headers ie, do not specify the format in which i need the response, i get a response in xml format.


permanent link
Ranjith Parameswaran (12311215) | answered Jul 05 '12, 12:09 p.m.


Hello,

 

was playing around with the API's and found, when we use the URL

https://jazz_team_server:9443/qm/oslc_qm/contexts/_87QhAL_AEeGRTIg3pl5i3w/resources/com.ibm.rqm.planning.VersionedTestCase

to query all the testcases , i dont get a json response but if we use a url that is more specific to a artifact as

"https://Jazz_team_server:9443/qm/service/com.ibm.rqm.integration.service.IIntegrationService/resources/_87QhAL_AEeGRTIg3pl5i3w/testcase/urn:com.ibm.rqm:testcase:7
" i did get a json response.

 

Is there any restriction as such?


Comments
Curtis d'Entremont commented Jul 05 '12, 1:15 p.m.
FORUM MODERATOR / JAZZ DEVELOPER

I'm not sure why you're seeing this - it might require text/json instead of application/json. I had a quick look at one OSLC spec and saw application/json but I'm not familiar with the specific one you're using. I recommend looking at the spec to see exactly what it supports and how you do content negotiation. If it doesn't work as it says it's supposed to, then that would be a bug in the service and you should file a defect.


permanent link
Ranjith Parameswaran (12311215) | answered Jul 06 '12, 7:18 a.m.


Hello curtis,

 

Thanks for the comments. I did try out with various header combinations, but was not able to get a response in json format using Location for simple query of Test Cases,Test plan or any other test artifacts.

 

Will raise a defect to follow this up.

 

Thanks!!


permanent link
Pramod Chandoria (2.1k11220) | answered Jul 07 '12, 8:18 a.m.
JAZZ DEVELOPER
Hi @ranparam json response is not supported for RQM's reportable rest API. The only format it supports is XML.

You can also use RQM's OSLC QM API and response should be often in RDF.

In either case RQM doen't support json response for public API,

Comments
Albert Yao commented Jul 09 '12, 5:32 a.m.

@Pramod Chandoria, Is JSON response supported by RTC? It seems that I encountered the similiar problem when I used the RTC REST API.


permanent link
Ranjith Parameswaran (12311215) | answered Jul 09 '12, 4:01 a.m.
Hello Pramod,

Please refer the below link:

https://jazz.net/wiki/bin/view/Main/ResourceOrientedWorkItemAPIv2#GetRepresentations

it talks about the resource representations. Can you please check the same and let me know if i have missed out any information or point me to some article/references that explains the resource representation in a better way.

permanent link
Pramod Chandoria (2.1k11220) | answered Jul 09 '12, 7:16 a.m.
JAZZ DEVELOPER
@Albert , See this link for RTC API https://jazz.net/wiki/bin/view/Main/ReportsRESTAPI
I doubt RTC supports json response for public API

permanent link
Pramod Chandoria (2.1k11220) | answered Jul 09 '12, 7:18 a.m.
JAZZ DEVELOPER
Ranjith
I would retag it to RTC forum to get better answer from RTC expert

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.