Hello, I am trying to use the field startAt as the start of the Jira issueID to start the search of Jira issues in a Jira project. I am using the curl command to do a Jira Rest API to do a search query of the Jira Project, and would like to get the first 5 Jira IssueIDs. Below is the curl command that I am using:
/usr/bin/curl -s -u 'yyyyyyy:xxxxxxx' -X GET "https://jira.corp.adobe.com/rest/api/2/search?jql=project=DCMAF&fields=key,id,attachment&startAt=0&maxResults=5"
this query command outputs the last 5 Jira issues: Jira IssueID 128, 127, 126, 125, and 124 , but I am expecting Jira Issues: 1, 2, 3, 4, and 5 as the output. It looks like Jira is not honoring the usage of startAt field. Can someone help me to see if I am using the startAt correctly?
Hi @Lily Tran
You appear to be using startAt correctly, as it is the zero-based offset (index of the first record to return).
I wonder if something earlier in the URL is parsing incorrectly and so startAt is ignored. Maybe try removing the fields and maxResults to diagnose this piece by piece.
Best regards,
Bill
I tried to move the startAt and maxResults before the fields:
/usr/bin/curl -s -u 'xxxx:YYYYYY' -X GET "https://jira.corp.adobe.com/rest/api/2/search?jql=project=DCMAF&startAt=5&maxResults=3&fields=key,id,attachment"
and now my search output:
DCMFA-123, DCMFA-122, and DCMFA-121 where the last Jira Issue is DCMFA-128, from the output, it looks like the jql is doing a search backward -5 off from the last Jira IssueID. The reason I need to startAt to work correctly so that when my script run on a cron job, I want the next build to start off where the last build left off. This way each time it run, it only process the new Jira Issues.
Any help would greatly be appreciated.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
How about putting and ORDER BY clause on your JQL? That will enforce the order of the pulled data and make interpreting the output more predictable as you try to understand what is happening with startAt.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Bill;
Thanks, that did the trick by adding order by in my jql search. Below is update command line that work:
/usr/bin/curl -s -u 'xxxx:YYYYYY' -X GET "https://jira.corp.adobe.com/rest/api/2/search?jql=project+order+by+issue=DCMAF&startAt=5&maxResults=3&fields=key,id,attachment"
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I am glad that worked for you. Would you please mark this question as answered so others can find the solution more quickly? Thanks!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.