Hello,
I am trying to get issues from REST and having problems escaping special characters in command line.
For example, this works well (returns a valid JSON) through the browser:
https://flow-jira.ubs.net/rest/api/2/search?jql=project="Test Project"&sprint=201708R1&issue_type=Story,Maintenance
but when trying it through curl in command line--like this:
Curl -u user:password -X GET -H "Content-Type: application/json" https://jiraserver/rest/api/2/search?jql=project="Test Project"&sprint...
the JQL query breaks on special chars (space, &). I tried ="Test"%" "%"Project", "Test"\\%" "\\%"Project", and many other combinations of escape and concat characters and nothing works.
Any ideas?
Also, is there a better way to get issues from JIRA API as a batch job?
Thank you,
Alla
Hi Alla,
Do you run into this issue with any other commands that need the & symbol and what shell are you using?
To start off with, here is the curl command I used that was successful:
curl -u user:pass -X GET -H "Content-Type: application/json" http://localhost:8080/rest/api/2/search?jql=project="ATLAS"&sprint="ATLAS Sprint 1"
I ask about your shell because I am using zsh and part of the profile does not allow me to run this command. If I try to run the command with my shell settings I get the following:
zsh: no matches found: http://localhost:8080/rest/api/2/search?jql=project=ATLAS
If you are using a different shell or have changed your shell profile I would check that first.
Cheers,
Branden
I figured this.
Just needed to double-quote the whole URL:
Curl -u user:password -X GET -H "Content-Type: application/json" "https://jiraserver/rest/api/2/search?jql=project=Test Project&sprint..."
Now I am trying to figure out how to deal with the JSON response I am getting. I think I will need to use PowerShell but it may be above my head :) Also, it seems that curl is only getting 50 issues, not all of them. This seems to be a known bug.
Started a new thread (https://community.atlassian.com/t5/Jira-questions/Converting-JSON-output-to-csv/qaq-p/643792)
Thank you for responding though, Branden.
Cheers,
Alla
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.