Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
Level
0 / 0 points
Next:
badges earned

Your Points Tracker
Challenges
Leaderboard
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Recognition
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Kudos
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Jira Software Cloud REST API not respecting maxResults

Trying to get a list of 11,450 Jira Issues (3 fields) with the fewest number of requests possible (because the endpoint is being called by Salesforce which limits REST Callouts to 100/hour).

curl --request POST \
--url 'https://utilant.atlassian.net/rest/api/3/search' \
--user 'USER:PASSWORD' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data '{
"jql": "updatedDate>=2021-01-01 AND issuetype!=Test",
"maxResults": 1000,
"fields": [
"issuetype",
"summary",
"customfield_10090"
],
"startAt": 0,
"expand": ["names"]
}'

The above example looks like it would take 12 x REST Callouts to get 11,450 Jira Issues but it actually takes 115. Jira responds as if maxResults was set to 100 in its paginated reply.

{"expand":"schema,names","startAt":0,"maxResults":100,"total":11450,"issues":[...

Salesforce then blocks me when I make my 101st request. Checkmate.

Jira's documentation says, "To manage page size, Jira may return fewer items per page where a large number of fields are requested. The greatest number of items returned per page is achieved when requesting id or key only."

I need 3 fields (none of which are large).

Questions:

  1. Is there a way to reduce my page size? A fair amount of superfluous info is in the response to my query. Selecting any fields other than key or id limit the response to 100 records.
  2. Is there a different call I could make to get this info?

 

1 answer

1 accepted

1 vote
Answer accepted
Warren Community Leader Mar 02, 2021

Hi @Nate Stuyvesant 

In answer to the main question you have here, Atlassian changed the API a few years ago to limit the maximum number of returned results to 100 (until then it used to be 1000), so the parameter maxResults is more applicable if you're wanting results in chunks smaller than 100, not larger. To reiterate, you cannot get more than 100 results per API call. I realise that doesn't help you with Salesforce!

For your other questions :

  1. No, using the fields parameter as you are limits the actual fields being returned, but there is always some header info which comes through.
  2. As far as I know, all API calls are limited to 100 and all return additional header info.

If this is a one-off (or seldom run) exercise, a solution (whilst not ideal) would be to run the first 100 API calls, then wait until the next hour and run the rest.

@Warren - thanks for the response. Hope Atlassian can improve the documentation a bit more as this had me running in circles for a while (or loops of 100 records).

It's something I have to do monthly to clean up synchronized data. Guess I'll have to apply a different strategy.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
PERMISSIONS LEVEL
Site Admin
TAGS

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you