I’m trying to fetch all sprints that belong to a specific JIRA project using the REST API. I know I can get project details through the regular JIRA API and I can pull sprint information if I have a board ID using the agile endpoints. However, what I really need is a way to get either all sprints directly from a project identifier, or at minimum get all boards associated with a project so I can then loop through and grab sprints from each board. Has anyone found a working approach for this? I’ve been searching through the documentation but can’t find a direct project-to-sprints endpoint.
The approach Laura mentioned is correct, though I’d add that you might run into pagination issues if you have many boards or sprints. When calling the boards endpoint, make sure to handle the maxResults
and startAt
parameters since JIRA limits responses to 50 items by default. Same goes for the sprint endpoint - I learned this the hard way when I was only getting partial data back. Also worth noting that some boards might not have any sprints if they’re kanban boards, so you’ll want to filter for scrum boards specifically if that’s what you’re after. The board type is included in the response from the boards endpoint.
i feel ya, that jira api can be a pain. but yeah, start with /rest/agile/1.0/board?projectKeyOrId=YOUR_PROJECT
to get boards, then just loop through the board ids using /rest/agile/1.0/board/{boardId}/sprint
to fetch those sprints.
Been dealing with this exact scenario recently and ran into some authentication gotchas that might save you time. Make sure your API token has the right permissions for both the regular JIRA API and the agile endpoints since they sometimes have different permission requirements. Also, when you’re iterating through boards, you’ll want to check the board configuration because some projects have multiple board types mixed together. I found it helpful to add a small delay between API calls when processing multiple boards to avoid hitting rate limits, especially if you’re working with larger projects that have dozens of boards. The API can get a bit temperamental with rapid successive calls.