Reputation: 341
I'm trying to use curl to retrieve jira issue from my company server without any luck so far.
I've tested both examples described here JIRA REST API Example - Basic Authentication with no success. I base64 encoded my user and password as described in the "Supplying Basic Auth headers" example and entered the url for the issue I want to get. I tested the url in browser I get the json document so the url is correct.
This is what my command looks like
someuser@somehost:~$ curl -D- -X GET -H "Authorization: Basic base64encodedstringhere -H "Content-Type: application/json" https://jira.acme.com/rest/api/2/issue/KEY-666
And I then get prompt with ">" but no json document. Is there something I'm missing or doing wrong?
Thanks.
Upvotes: 1
Views: 6399
Reputation: 2406
Don't encode the user name and password - curl already handles this!
curl -u "username:password" -X GET -H "Content-Type: application/json" https://jira.acme.com/rest/api/2/issue/KEY-666
If you need to specify basic authentication, do it like this:
curl -D- -X GET -H "Authorization: Basic usernamesndpasswordbase64 -H "Content-Type: application/json" https://jira.acme.com/rest/api/2/issue/KEY-666
where the username-and-password string is username:password encoded together e.g. via
echo username:password | base64 | sed /Cg==/s///
Both of these work for me on curl under Cygwin.
Upvotes: 5