It's all about the answers!

Ask a question

cURL GET WI - RTC 4.0.3

Kartik Manchanda (767) | asked Feb 03 '14, 3:57 p.m.
edited Feb 04 '14, 2:37 a.m. by Krzysztof Kaźmierczyk (7.4k369102)

I am trying to perform a GET call using cURL. Below is the script. However below does not create wi-53.xml. Need help to figure this out.

set COOKIES="C:\RTC\OSLC\cookies.txt"
set USER=xxxx
set PASSWORD=xxxx
set URL="http://ccm-host/ccm/oslc/workitems/53"
set host="http://jts-host"

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

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

curl -D - -k -b %COOKIES% -o "wi-53.xml" -H "Accept: application/x-oslc-cm-change-request+xml" %URL%


cookies.txt :

# Netscape HTTP Cookie File
# This file was generated by libcurl! Edit at your own risk.

jts-host FALSE / FALSE 786297600 WASReqURL ""
jts-host FALSE / FALSE 0 LtpaToken2 A1DKJYhHcw4po2eeUP2Wx6TVy4D7FB640pIrxiN9RXHoRwz5IS67o8ggEt+Re0dG+big6xs/1hlolfsJAZgF/PUH24Tt4Ugc2dgA2rGyXb3enupjOfg6EzTmJnRsJp6CVIATvTrlo050Cf6SJvwqBDKZOl5cQAuGT5rHt0HaVq6rYIGGlz4MWK6LsLi5urTlfMXBMUuzTYPxkc2JdkpnZ24CAMYM/+KSV20rX5pq14OU6YEzqYIRbQAmnhADfPl5qoIXqDPwFNNL5e7FLTaRkIGWxU9MZnsEqJcFrLSSi1Tl/Z4eebdyakBASNphI1Y4MaB5HR4ayjFlVjT6BZ21iGFFhldhNbtJ5MTd2QxvVY7QRvCR3AHkz/f/V423AYGGptckkQpjbKhhdx4U6xNUZgKp4chYUuFyeATP3hab0+4aDStpUn0QG6W/szQq1fg4jUQy211rnJ4i0ePXE8cX0qP/UVsbByYPN9eIPosQj4N/nYc/yUppcZHdkVrhfigasp5/TwfbNSO1kbPl4Q8QmraB407OY3Th4XU1USsqGaJL4ovnvi0Tp8tjyPGi7kHTW49AcykkUVr9c8UNqa4w2OKs3AFS1s1wpd1awXRdkQLoOCLIzty5Oq38S3ELNyFBgwV/4n0INByqLog4gCVxZKrmUC1ofyqzh0xfx1bZ18KlK3Iwej8s8p5unDbx/73RryvdXlNq3q5lm8HcdZglVg==
jts-host FALSE / FALSE 0 JSESSIONID 00005zrv-9vFaCxCJnYtQqIsquM:-1
jts-host FALSE /jts/authenticated/ FALSE 0 X-com-ibm-team-foundation-auth-loop-avoidance false

Accepted answer

permanent link
Simon Washbrook (67216) | answered Feb 04 '14, 2:27 a.m.
Hi Kartik,

Try adding "?" to your URL to say that you want the description of the work item.
Add the verbose flag to cURL also helps to understand what is happening

This worked for me:

# Update this line with the name of server
HOST="https://<your hostname>/ccm"

# Comment this line when it works


# Perform Form based authentication using curl
curl -k -c $COOKIES -o tmp.html "$HOST/authenticated/identity"
curl -k -L -b $COOKIES -c $COOKIES -o tmp.html -d j_username=$USER -d j_password=$PASSWORD "$HOST/authenticated/j_security_check"

# Add which bit of the work item we want to extract

# Get the work item in XML format
curl -D header.txt -X GET $VERBOSE -k -b $COOKIES -o $OUTPUT -H "Accept: application/x-oslc-cm-change-request+xml" $URL

Kartik Manchanda selected this answer as the correct answer

Kartik Manchanda commented Feb 04 '14, 1:17 p.m.

Thank You SImon..Finally seems to be heading in the right direction. Much appreciated. 

Kartik Manchanda commented Feb 04 '14, 1:41 p.m.

Another QQ : In order to get a state of a particular WI, it this correct?

 set URL=%URL%?

One other answer

permanent link
Simon Washbrook (67216) | answered Feb 05 '14, 2:30 a.m.
Hi Kartik,
If you use


Then you will get
<?xml version="1.0" encoding="UTF-8"?>
<oslc_cm:ChangeRequest xmlns:rtc_cm="" xmlns:oslc_cm="" xmlns:rdf="" rdf:about="https://$HOST/ccm/resource/itemName/">
<rtc_cm:state rdf:resource="https://$HOST/ccm/oslc/workflows/_Zu67at-uEeCFsdAYmU6XKQ/states/bugzillaWorkflow/3"/>

So the state is enclosed in a <oslc_cm:ChangeRequest> tag and the value is a reference to the resource that describes the state. If you follow the link to the resource then you will get the information about the id and a title that is human readable. Like this:

<rtc_cm:Status rdf:about="https://$HOST/ccm/oslc/workflows/_Zu67at-uEeCFsdAYmU6XKQ/states/bugzillaWorkflow/3">


Kartik Manchanda commented Feb 07 '14, 3:20 p.m.


Could you look @
I am would have done it in past.

Once again thanks

Your answer

Register or to post your answer.