1

Good Day All, I'm having some issues forming the right JQL syntax for a Jira curl request. Here is what I currently have, and this is working.

curl -D- -u jenkins:password123 -X POST -d "{\"jql\": \"issuetype = 'Broker AutoDeploy' AND status = 'In Progress'\",\"fields\":[\"key\"]}" -H "Content-Type: application/json" http://jira.site.com:8080/rest/api/2/search

This curl will return the correct issue, but will only give me the "key" of those issues. I've tried adding onto the end of my jql, something like this below.

"{\"jql\": \"issuetype = 'Broker AutoDeploy' AND status = 'In Progress'\",\"fields\":[\"key\"],[\"status\"]}"

But I get errors, as I'm not certain of how to form my syntax. Does anyone know the proper syntax to do something like this?

Thank you for any insight!

2 Answers 2

1

Looking at the example from Atlassian's REST API documentation pages, you should be specifying the fields you'd like to include as a comma-separated list: key,status in your case.

Your updated JQL parameter should look like this:

"{\"jql\": \"issuetype = 'Broker AutoDeploy' AND status = 'In Progress'\",\"fields\":\"key,status\"}"
Sign up to request clarification or add additional context in comments.

Comments

1

Thank you Adil B, Your answer was really close and It got me to the correct syntax. Here is what worked for me.

{\"jql\": \"issuetype = 'Broker AutoDeploy' AND status = 'In Progress'\",\"fields\":[\"issuetype\",\"status\"]}

I needed to separate each field being requested with its own set of quotation marks, also since key is the primary key, I didn't have to specifically request for it.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.