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/
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
One answer
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
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
Comments
sam detweiler
Nov 26 '14, 2:44 p.m.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
Joseph Simon Arokiaraj
Nov 26 '14, 8:31 p.m.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