Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How to format curl request for a Jira filter?

Matt Kimball April 12, 2019

Good Day,

I am attempting to run a curl command to return the contents of a filter. This is currently working with another Jira filter, with the syntax below.

curl -D- -u jenkins:* -X POST -d "{\"jql\": \"project=mmb AND status!='Deployed to Production' AND status!='Approved for Production' AND status != Complete AND status != Cancelled AND 'Deployment Information' is not EMPTY AND 'MMB-Environment(s)' = TST1\",\"fields\":[\"key\"]}" -H "Content-Type: application/json" http://jira.*.com:8080/rest/api/2/search

 What I would like to do is modify this curl request to send a different filter, but i'm sure i'm missing something with my syntax. I've been playing around with it getting various different errors. The documenation is only helping so much. Here is what I am attempting

curl -D- -u jenkins:* -X POST -d "{\"jql\": \""Remedy CRQ " = "791083"",\"fields\":[\"key\"]}" -H "Content-Type: application/json" http://jira.*.com:8080/rest/api/2/search

This field called Remedy CRQ is a number field. How do i properly format this curl request to get a response? Any advice or assistance is appreciated! Thank you

1 answer

1 vote
Payne
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 12, 2019

I notice that you have a space after CRQ before the closing " in your JQL

I'm also not sure about your embedded double quotes in the string. Maybe try changing those to single quotes, i.e.

curl -D- -u jenkins:* -X POST -d "{\"jql\": \"'Remedy CRQ' = '791083'\",\"fields\":[\"key\"]}" -H "Content-Type: application/json" http://jira.*.com:8080/rest/api/2/search
Matt Kimball April 12, 2019

Thank you Payne, It was the single quotes that did it. (I needed that space after CRQ, maybe that field was setup with a space on accident)

Appreciate the quick response!

Like Payne likes this

Suggest an answer

Log in or Sign up to answer