It's all about the answers!

Ask a question

How to get the result by Json in Rest API ?


vinitha dsouza (1211259) | asked Feb 19 '16, 1:20 a.m.
Hello

I want to get the Result in Json for Rest Url

Below is the link i am using to get the result using json. Please let me know where i am missing ?

https://rb-ubk-clm-04.de.bosch.com:9443/ccm/rpt/repository/workitem?fields=workitem/workItem[id=%275501%27]/%28children/%28target/name|id|category/name%29%29&_mediaType=text/json&_pretty=true

2 answers



permanent link
Ralph Schoon (59.0k23642) | answered Feb 19 '16, 1:38 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
Please go through the
Open Services for Lifecycle Collaboration Workshop

You have to specify application/json in the request header. the mediaType is not what OSLC is looking for.

Comments
vinitha dsouza commented Feb 19 '16, 3:13 a.m.

hello Ralph

i tried even with this link :
https://rb-ubk-clm-04.de.bosch.com:9443/ccm/rpt/repository/workitem?fields=workitem/workItem[id=%275501%27]/%28children/%28target/name|id|category/name%29%29&_mediaType=application/json&_pretty=true
but we  are not getting the result in json format :(


Ralph Schoon commented Feb 19 '16, 3:19 a.m. | edited Feb 19 '16, 3:19 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

I would really consider to read the document and play with the examples to understand what you need to do. Just adding stuff to the URL does NOT set the request header.


Ralph Schoon commented Feb 19 '16, 3:39 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

This is a screenshot of a REST client with proper headers set:
Do the Open Services for Lifecycle Collaboration Workshop



permanent link
Donald Nong (14.4k314) | answered Feb 21 '16, 7:26 p.m.
I don't think the RTC reportable REST API is implemented with JSON at all. It ignores "Accept" header, and does not recognize file extension (*.xml, *.json and etc). It _always_ respond with XML content (there is no content negotiation). In other words, no matter how you "trick" the server, it will not give you media type other than XML.

Comments
Ralph Schoon commented Feb 22 '16, 3:46 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

Didnt know that Don. Thanks for sharing.

Your answer


Register or to post your answer.