Forums

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

How can I format my syntax to properly Curl for more MaxResults with REST API

Matt Kimball May 12, 2020

Good Day all,

I have two curl commands I am using in my scripts. One references a static filter directly and the other inserts dynamic JQL during run time. 

1. Accessing Static Filter

curl -s -X GET -H "Content-Type: application/json" http://jira.*.com:8080/rest/api/2/search?jql=filter=55102^&fields=id,key,issuetype,customfield_10613,customfield_10200,customfield_10030^&maxResults=500

 2. Dynamic JQL search

curl -D- -u *:* -X POST -d "<LotsOfJQL>" -H "Content-Type: application/json" http://jira.*.com:8080/rest/api/2/search"

 Both of these above commands work! And with the first command i am getting over 200 results so I know the maxResults=500 is working. However, when I try adding ^&maxResults=500 to the end of my 2nd script, I don't get any errors but the maxResults is still 50 and isn't changed.

 

How can I format my syntax properly with my Dynamic search so maxResults will be recognized?

 

I appreciate your time and responses. Thank you.

2 answers

1 accepted

0 votes
Answer accepted
Hana Kučerová
Community Champion
May 12, 2020

Hi @Matt Kimball ,

could it be, that you should add ?maxResults=500 instead of &maxResults=500? Because in the second case it is the first parameter.

Matt Kimball May 12, 2020

I've tried this aswell, no luck

Hana Kučerová
Community Champion
May 12, 2020

@Matt Kimball Please look at this page to the section Searching for issues using POST, there is a nice example.

You should be able to see in response, whether the param maxResults was changed or not.

Like Matt Kimball likes this
Matt Kimball May 13, 2020

Thank you for your assistance Hana! I found the answer in there. Here is what I'm using now that works.

 

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

0 votes
Jaap van Driel October 27, 2020

I have tried this command :

curl -o jira.out -u "user:token" -s -X GET -H "Content-Type: application/json" https://url/rest/api/2/search?jql=filter=<filter>

 

and it produces output, but in the far does not look like what I would have expected, which is similar to running the filter in my browser and export as CSV (selected fields).

Am I missing something?

 

Thanks.

Suggest an answer

Log in or Sign up to answer