Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

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

'Total' field is missing from the api response Edited

In the jira rest API doc for getting all sprints the api given is GET /rest/agile/1.0/board/{boardId}/sprint and the response is given as,

{ "maxResults": 2, "startAt": 1, "total": 5, "isLast": false, "values": [ { "id": 37, "self": "http://www.example.com/jira/rest/agile/1.0/sprint/23", "state": "closed", "name": "sprint 1", "startDate": "2015-04-11T15:22:00.000+10:00", "endDate": "2015-04-20T01:22:00.000+10:00", "completeDate": "2015-04-20T11:04:00.000+10:00", "originBoardId": 5 }, { "id": 72, "self": "http://www.example.com/jira/rest/agile/1.0/sprint/73", "state": "future", "name": "sprint 2" } ] }

 

 

here the field 'total' is in the api response but when calling the api all the other fields except "total' is coming...

how to get the total count of sprints in a board? 

1 answer

Sprints are specific to boards, not projects.

If you wanted to know the total sprints for a project, you'd have to get a list of all the boards first, then iterate through querying each board to get the number of sprints in that board, then total them all up.

Sorry let me correct one thing first,  I am looking to find out a way to get the total sprints in a board.

Say there is a board and it consists of 90 sprints and when I run the API,  the response will consists of maximum 50 results. I'm wondering how to get the remaining 40 sprints in that board without having the total value in the API response.

If there is total value then I could use maxResults=total value

Also I've tried  GET /rest/agile/1.0/board/{boardId}/sprint? maxResults=x where x is a static value. But whenever I tried to give x value higher than 50 it won't show the maximum value(maxResults) as x in the API response instead it shows 50.

So how could I get the total sprints in a board?

For various objects, the REST API restricts the number of results returned to help manage processing load. When this happens, you need to do your searches in batches of that number; in this case it's batches of 50.

You use the startAt parameter to set the index point of where to start each search. You start at 0 then increment it by 50 each time until all the results have been returned or the value isLast is returned as true.

Refer to the Expansion, pagination, and Ordering section of the REST API documentation to understand how to use startAt, maxResults, total and isLast together in your queries to get all the sprints from a board.

Suggest an answer

Log in or Sign up to answer
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