It's all about the answers!

Ask a question

Using REST API from cURL.


Nagesh Subrahmanyam (771211) | asked Nov 02 '11, 2:47 a.m.
Has anyone got the REST API from cURL working ? I am following the instructions in the wiki here. For all the commands (starting from the one for authentication), I get a result as "the browser not supporting JavaScript". Therefore, when I run cURL from command line for a work item (such as one below), I am still getting the same error about missing JavaScript. The resulting XML is also malformed.
curl -k -L -b <COOKIE_PATH> -c <COOKIE_PATH> <HOST>/oslc/workitems/<WORKITEM_NUM>.xml

But, when the same URL (as used in cURL) is entered in browser I get a valid XML as output with all details as expected.

I am using cURL on my Linux (Ubuntu) laptop.

One answer



permanent link
Adrian Schroeter (71142) | answered Aug 21 '12, 11:44 p.m.
 have a look at this article that might help you with using curl to interact with the REST API https://jazz.net/library/article/194/ the perl scripts provided in the document work for me under 3.1 didn't test it for 4 yet

Comments
SUNIL KUURAM commented Aug 15 '13, 7:31 p.m.

I have tried following the technote. I was able to login and create cookie. However, accessing any URL, work item etc. renders HTML content that shows "loading..." and nothing else. Any ideas?

Thanks
Sunil


sam detweiler commented Aug 15 '13, 10:34 p.m.

here is a little CURL based script.
it was built on windows, but you get the idea.

this gets all the project names on the server that the user has access to.

<code>
set COOKIES=.\cookies.txt

set USER=
set PASSWORD=
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
</code>

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.