How to retrieve all Jira project releases through API?

Chris Spencer October 1, 2018

How do you retrieve all the releases through the API that are shown on the "Releases" page in Jira cloud?

e.g.

https://myproject.atlassian.net/projects/myproject?orderField=RANK&selectedItem=com.atlassian.jira.jira-projects-plugin%3Arelease-page&status=unreleased

 

 

The Python API has has a `version(id)` function, but it requires an ID. I need to lookup all the releases that have been created, just just a specific one.

3 answers

4 votes
Andy Heinzer
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
October 2, 2018

In this case, I think you are looking for a specific version name/number, namely the unreleased ones in that project.  As such you can retrieve this by using the endpoint of GET /rest/api/3/project/{projectIdOrKey}/version  More details on the syntax of this can be found in Get project versions paginated.

This endpoint will allow you to use the status parameter in your REST call, which you can enter the value of 'unreleased' in order to see all those versions in that project that have not yet been released.

2 votes
Chris Spencer October 3, 2018

I ended up using the Python wrapper for the API and doing:

 

    jira = JIRA({'server': server_name}, basic_auth=(username, password))

    versions = jira.project_versions(myproject_key)

web January 4, 2021

year 2021 :

this method might have changed to :
get_project_versions(self, key, expand=None)

1 vote
Steve Suranie July 24, 2023

Thought I would update this with how I am doing it using the Jira wrapper: 

from jira import JIRA
from jira.client import ResultList
from jira.resources import Issue



rootURL = "https://xxxxxxxxxx.atlassian.net"




##############################################

# functions

##############################################



def getReleases(jira):

    dictVersions = jira.project_versions("KME")

    for thisVersion in dictVersions:

        print(dir(thisVersion))

        break



##############################################

# app starts here

##############################################



#jira setup

print(f"Getting Jira authentication...")

jiraOptions = {'server': "https://xxxxxxx.atlassian.net"}

jira = JIRA(options=jiraOptions,

    basic_auth=(YOUR-USERNAME, YOUR-API-TOKEN),  # Jira Cloud: a username/token tuple

)

getReleases(jira)

For each instance of the Version class you can access this data: 

'archived', 'delete', 'find', 'id', 'name', 'projectId', 'raw', 'releaseDate', 'released', 'self', 'update', 'userReleaseDate'

Suggest an answer

Log in or Sign up to answer