0
votes

I'm trying to get the number of an active sprint onto a dashboard using JIRA agile api but there are multiple active sprints on the board and I'm only interested in the sprint named #{SomeNumber}. (the # is what I'm looking for)

I tried to add a query parameter to my request - jira.acme.com/rest/agile/1.0/board/42/sprint?name=#69 - but it seems to be ignored and JIRA will answer with all existing sprints on that board. However, doing the same thing with boards works and I can properly query sprints by state.

Am I doing something wrong or is querying sprints like this just not intended?

edit: I should add, that the doesn't seem to be caused by the # as querying with words that occur in sprint names doesn't work either.

1

1 Answers

0
votes

I don't know of a way to directly find a sprint by name or regex on the name. However, if you have a board associated with some sprints, you can go that route. I'm doing something similar where I use sprints() to grab the active sprints from my board (since we only have 1 active sprint at a time this ends up working for me). If you wanted to go by name you could grab all the sprints from the board and iterate over them to match by name.

python eg.

from jira import JIRA
from jira.resources import GreenHopperResource

def find_active_sprint_by_name(the_sprint_name_im_looking_for):
    jira_options = {
        'server':your_jira_server_url,
        'agile_rest_path':GreenHopperResource.AGILE_BASE_REST_PATH
    }
    jira_api = JIRA(jira_options, basic_auth=(jira_username, jira_password))
    active_sprints = jira_api.sprints(board_id=your_board_id, state='active')
    for sprint in active_sprints:
        if sprint.name == the_sprint_name_im_looking_for
            return sprint
    return None