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

Rest API Curl to query and create workitem - RTC

I have tried to view all the workitems on a project using RestAPi and Curl and it doesn't return anything.If I tried the same URL on the browser, its giving me the information in XML format.

 

curl -k -b C:\CLM\cookies.txt https://server:9443/ccm/oslc/ contexts/_ M9gxUnC3EeSxPfxc8QYuYQ/ workitems

 

Also tried to create a workitem using Curl.Is there any easy way to get the xml request template for different types of workitems? if I get the template, I can easily use the template to populate the values.

 

Could anyone please help me on this?

 

Cheers,

Jose

0 votes

Comments

you must logon first.
here is one of my starter scripts

set COOKIES=.\cookies.txt

set USER=xxxx
set PASSWORD=yyyy
set HOST=https://localhost:9743


curl -k -c %cookies% "%host%/jts/authenticated/identity" >nul

curl -k -L -b %COOKIES% -c %COOKIES% -d j_username=%USER% -d j_password=%PASSWORD% "%host%/jts/authenticated/j_security_check" >nul

curl -k -L -b %COOKIES% "%host%/ccm/oslc/workitems/catalog

Hi Sam,

I have got the URI "curl -k -b C:\CLM\cookies.txt https://server:9443/ccm/oslc/ contexts/_ M9gxUnC3EeSxPfxc8QYuYQ/workitems" by invoking curl -k -L -b %COOKIES% "%host%/ccm/oslc/workitems/catalog

No idea why it is not returning all the workitems. Authenication was successful for me.

Cheers,

Jose



One answer

Permanent link
I had to add the accept header, same batch file as before

I did catalog to find the request for projects,

then executed that to get the service for workitems on that project
curl -k -L -b %COOKIES% %host%/ccm/oslc/contexts/_GYeCsFT4EeKDJbr7x3deog/workitems/services.xml

then called the service for workitems, on that project
curl -k -L -b %COOKIES% -H "Accept: application/xml" %host%/ccm/oslc/contexts/_GYeCsFT4EeKDJbr7x3deog/workitems

0 votes

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,929
× 7,489

Question asked: Nov 26 '14, 1:33 p.m.

Question was seen: 8,246 times

Last updated: Nov 26 '14, 9:55 p.m.

Confirmation Cancel Confirm