How to login via the REST API?
I can pass HTTP commands via the REST API without issue if I am already logged in via another browser window. However if I am not, I get the prompt for username and password. How do I pass the username and password as part of the HTTP command via the REST API? For example, what would you add to the following to also login?
https://SERVER:PORT/jts/rpt/repository/foundation?fields=foundation/contributor/(userId|name|archived)&size=999
I tried &usedId=xxxxx&password=xxxx but that was ignored - didn't even get an error.
https://SERVER:PORT/jts/rpt/repository/foundation?fields=foundation/contributor/(userId|name|archived)&size=999
I tried &usedId=xxxxx&password=xxxx but that was ignored - didn't even get an error.
Accepted answer
logon is a two step process, it cannot be embedded in another call.
here is a little batch file using curl that will logon and get the list of projects on a server
set the user, password and host variables
set COOKIES=.\cookies.txt
set USER=
set PASSWORD=
set HOST=https://localhost:9743
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 -k -L -b %COOKIES% "%host%/ccm/oslc/workitems/catalog
here is a little batch file using curl that will logon and get the list of projects on a server
set the user, password and host variables
set COOKIES=.\cookies.txt
set USER=
set PASSWORD=
set HOST=https://localhost:9743
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 -k -L -b %COOKIES% "%host%/ccm/oslc/workitems/catalog