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.
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.
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)
year 2021 :this method might have changed to :get_project_versions(self, key, expand=None)
Thought I would update this with how I am doing it using the Jira wrapper:
from jira import JIRAfrom jira.client import ResultListfrom jira.resources import IssuerootURL = "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 setupprint(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'
It looks like you're new here. Sign in or register to get started.