It's all about the answers!

Ask a question

RTC 6.0.2 - Query work items curl command


Robson Miranda (111) | asked Aug 16 '17, 7:52 p.m.
Hi,

This is my Project Area simple query link
https://gid.caixa:9443/ccm/oslc/contexts/_KiyJFyYUEeOUpOocmzUjUQ/workitems

Generate the cookie

set USER=philippe
set PWD=philippe
set COOKIES=cookies.txt
 

curl.exe -k -L -b %COOKIES% -c %COOKIES% -d j_username=%USER% -d j_password=%PWD% https:/
/gid.caixa:9443/ccm/authenticated/j_security_check

Try run this command to get the work items
curl.exe -k -b %COOKIES% https://gid.caixa:9443/ccm/oslc/contexts/_KiyJFyYUEeOUpOocmzUjUQ/workitems

But the command don't returns the items. Nothing is displayed on output.

Questions:
1) Is the command right? Why don't returns the items?
2) What curl command to get items by type in a Project Area?

Thanks

One answer



permanent link
Donald Nong (14.5k414) | answered Aug 18 '17, 12:57 a.m.

Adding the -v parameter will give you more detailed information about what you actually get.

When I followed the exact commands, I got the same result and the response of the third command was "HTTP/1.1 406 Not Acceptable". This is because cURL by default sends out HTTP request header "Accept: /". So to get the desired result, you need to send an HTTP requested header "Accept: application/xml". The third command should look like:
curl.exe -v -k -H "Accept: application/xml" -b %COOKIES% https://gid.caixa:9443/ccm/oslc/contexts/_KiyJFyYUEeOUpOocmzUjUQ/workitems

That should answer your first question.

For the second one, it's not about cURL, but rather the OSLC URL that you put in the command. See the below document for details.
https://jazz.net/wiki/bin/view/Main/WorkItemAPIsForOSLCCM20#Query_Capabilities


Comments
Robson Miranda commented Aug 18 '17, 7:18 p.m.

Hi Donald,
Thanks by answers.
For th first question, I run the command proposed by you, but with bit differences.
The right HTTP reader in this case is ""Accept: application/x-oslc-cm-change-request+xml".
I was forced to include the "oslc_cm.pageSize" argument because the pagination. The maximum value is "100".

Then, the runned command was:

curl.exe -v -k -H "Accept: application/x-oslc-cm-change-request+xml" -b %COOKIES% https://gid.caixa:9443/ccm/oslc/contexts/_KiyJFyYUEeOUpOocmzUjUQ/workitems?oslc_cm.pageSize=100

Is There a way to disable or bypass the pagination?
Stay I limited to 100 workitems on a query result?

For the second question (get items by type), I didn't read the link posted yet.
Return as soon as I read.

Thanks Donald

Your answer


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