Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

Java & REST API question

I am writing a Java program which will get the xml of a workitem. After authentication when I try to get the work item (https://localhost:9443/ccm/resource/itemName/com.ibm.team.workitem.WorkItem/99.xml)

and I always get the user info in json format as descried here 

https://jazz.net/forum/questions/64839/httpslocalhost9443jtsprocessproject-areas

I am using http client 4.3.3 

I am able to get xml using curl as well as REST client for Firefox

Anyone has any idea why I get my user info in json format?


0 votes

Comments

Which headers are you including to your rest call?
Accept = application/xml or aaplication/json

I also see that you add .xml at the end of your url. You dont need to do that.

I already have it


These are my headers

httpget.addHeader("Accept", "application/xml");
httpget.addHeader("Content-Type","application/xml, charset=UTF-8");
httpget.addHeader("Accept-Charset","UTF-8") 


Accepted answer

Permanent link
Karthik
There are Java samples in the OSLC workshop https://jazz.net/library/article/635
Karthik Krishnan selected this answer as the correct answer

1 vote

Comments

Thanks. I tried the example and it worked. I have no idea what is wrong with my code as it is almost identical except that I am using HTTP Client 4.3.3. 


thanks anyway

Your answer

Register or log in 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.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 10,935
× 515
× 478

Question asked: Apr 30 '14, 9:30 a.m.

Question was seen: 5,934 times

Last updated: Apr 30 '14, 11:02 a.m.

Confirmation Cancel Confirm