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:
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.
Also, is there a better way to get issues from JIRA API as a batch job?
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.
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.
Connect with like-minded Atlassian users at free events near you!Find a group
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no AUG chapters near you at the moment.Start an AUG
We're bringing product updates and pro tips on teamwork to ten cities around the world.Save your spot