Using 6.0 REST API with CURL
I'm having some trouble authenticating to a cmm instance using curl.
The server is at 6.0 and I've tried options like the one in this technote https://jazz.net/library/article/194/
The code :
set COOKIES=.\cookies.txt
set USER= set PASSWORD= set HOST=https://localhost:9443 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
Cookies retrieved:
Did anyone try this scenario and has a solution ?
I saw several forum entries saying that using curl & the technote instructions still work for version 5 but it doesn't in 6.0. Also, I didn't find anything relevant in the knowledge center so any ideas are appreciated.
|
3 answers
works for me on 6.0.1
using same set= must have a valid userid and password 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% -H "Accept: application/xml" %host%/ccm/oslc/workitems/catalog |
You may have problems with it if it's a distributed environment. Try to use /ccm for all the URLs (replace "jts" with "ccm").
|
Thanks for the answers. Unfortunately not much progress.
This is indeed a distributed env and I changed the urls to /ccm
I also modified the 2nd line to:
curl -v -k -L -b %COOKIES% -c %COOKIES% -d j_username=%USER% -d j_password=%PASSWORD% -H "Content-Type: application/x-www-form-urlencoded; charset=utf-8" "%host%/ccm/authenticated/j_security_check"
bu it also didn't help.
The response I get is the standand text/html one (pasted a part of it):
It seems I'm following all the steps documented also here: https://jazz.net/wiki/bin/view/Main/WritingAJazzClient
but for some reason the authentication part fails for me.
Comments
Donald Nong
commented Jul 04 '16, 9:04 p.m.
Are there any special characters in your username or password? The HTTP request header Content-Length has a value of 68, which is way too large. This translates to a pair of username and password with 45 characters in length. Are they really this long? Also the response header Location for the POST is /ccm/auth/authfailed, which also indicates that you send the wrong username/password to the server.
Bogdan Moldoveanu
commented Jul 05 '16, 7:29 a.m.
Yes , the user name and password are that long.
I do have special characters in them like .+@ but these shouldn't require escaping . I also used quotes as a test on pwd & username but I have the same result
Donald Nong
commented Jul 06 '16, 3:25 a.m.
I guess you use an email address as the user Id, and that should be OK. But the plus sign(+) poses a big problem. As long as I change the password to include a plug sign, I cannot find a reliable way to log on any more. I believe this is the issue discussed here:
|
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.