Is there a way to use the JIRA API to retrieve Release Notes of a fixVersion?

Shawn Bates April 28, 2021

It looks like the UI html syntax has changed.  Now I'm unable to use a workaround to retrieve release notes.  Is it possible use the JIRA API to get the release notes from fix version .

2 answers

1 accepted

2 votes
Answer accepted
Darryl Lee
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 28, 2021

Oooh, this feature request has been around for a long time:

https://jira.atlassian.com/browse/JRASERVER-3855
https://jira.atlassian.com/browse/JRACLOUD-3855

What was your workaround? 

So the page is easy(ish) to get to:

https://YOURSITE.atlassian.net/secure/ReleaseNote.jspa?projectId=11333&version=10333

You can certainly find the Project ID and Version via the API: https://nortekcontrol.atlassian.net/secure/ReleaseNote.jspa?projectId=11317&version=10529

But the really tricky part is getting that nicely formatted HTML out of Jira...

Back in 2014, Henri used sed to extract them:

http://blog.tremblay.pro/2014/10/extract-release-notes-from-jira.html

But man, in 2021, everything's Javascript. I don't see the rendered HTML anywhere when I did `acli --action renderrequest` (saves me having to do auth in curl).

I wonder if Selenium or the like could simulate loading that page and clicking on "Copy to clipboard":

Screen Shot 2021-04-28 at 8.27.05 PM.png

Or, building it all up by hand from REST queries, as suggested here:
https://community.atlassian.com/t5/Answers-Developer-Questions/How-do-I-access-Release-Notes-HTML-data-VIA-JIRA-API/qaq-p/573074#M110730

Or maybe doing it with Confluence?
https://confluence.atlassian.com/doc/blog/2015/10/how-to-document-releases-and-share-release-notes

Sorry I couldn't find a better answer. If you can share your workaround, maybe we could build on that.

Darryl Lee
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 28, 2021
Shawn Bates April 29, 2021

I was using Henri's approach as the workaround.

http://blog.tremblay.pro/2014/10/extract-release-notes-from-jira.html

Vincent Richard February 17, 2022

Hi, I'm not an expert in Python but still, I ended up writing a little script doing the job. It takes three parameters :

1 - A username

2 - A password

3 - A part of the version name (I use it with X.Y.Z knowing that I don't have two version names containing the same version numbers)

#!/bin/python3

import sys, requests, json

def getProjectVersionFromNamePart(versionNumber):
    response = requests.get(jiraBaseUrl + 'rest/api/2/project/' + project + '/versions', auth=auth)
    versions = response.json()

    for version in versions:
        if (versionNumber in version['name']):
            return version
    return None

def getProjectIssuesFromVersion(projectVersion):
    jql = 'project = ' + project + ' AND fixVersion = "' + projectVersion['name'] + '" AND resolution IS NOT EMPTY ORDER BY key'
    params = {'projectId':projectVersion['projectId'], 'maxResults':1000, 'jql':jql}
    response = requests.get(jiraBaseUrl + '/rest/api/2/search', auth=auth, params=params)
    return response.json()

def printIssue(issue):
    print('<li>[<a href=\'' + jiraBaseUrl + '/browse/' + issue['key'] + '\'>' + issue['key'] + '</a>] - ' + issue['fields']['summary'] + '</li>')

def collectIssueTypeNames(issues):
    issueTypeNames = []
    for issue in issues:
        typeName = issue['fields']['issuetype']['name']
        if typeName not in issueTypeNames:
            issueTypeNames.append(typeName)
    issueTypeNames.sort()
    return issueTypeNames

def printReleaseNotes(projectVersion, projectIssues):
    print('<h2>' + projectVersion['name'] + '</h2>')
    print(projectIssues['total'], 'issues.')
    
    issueTypeNames = collectIssueTypeNames(projectIssues['issues'])
    for issueTypeName in issueTypeNames:
        print('')
        print('<h4>' + issueTypeName + '</h4>')
        print('<ul>')
        for issue in projectIssues['issues']:
            if issue['fields']['issuetype']['name'] == issueTypeName:
                printIssue(issue)
        print('</ul>')

project = 'YOURPROJECT'
jiraBaseUrl = 'https://your.jira.server.org/'

# auth=(user, password)
auth=(sys.argv[1], sys.argv[2])

projectVersion = getProjectVersionFromNamePart(sys.argv[3])
# print(json.dumps(projectVersion, indent=2))

projectIssues = getProjectIssuesFromVersion(projectVersion)
# print(json.dumps(projectIssues, indent=2))

printReleaseNotes(projectVersion, projectIssues)

 

Hope this can help others ;)

Like Dmytro Pylypenko likes this
0 votes
Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 28, 2021

Hi @Shawn Bates 

Do you know the version ID?  If so, you could just do a JQL search on fixVersion=myID with

https://docs.atlassian.com/software/jira/docs/api/REST/1000.824.0/#api/2/search

If you know more about the version, you could use the JQL functions in the query, such as

project = myProject AND fixVersion = latestReleasedVersion()

or

project = myProject AND fixVersion = earliestUnreleasedVersion()

 

Best regards,

Bill

Shawn Bates April 28, 2021

Hi Bill, I'm trying to use the curl command. Would you have an example?

Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 28, 2021

Hi Shawn,

Please look here for an example of calling the REST API with curl. This example is for JSM and the ideas work for Jira Cloud.

https://community.atlassian.com/t5/Jira-Service-Management/REST-API-curl-example/qaq-p/1486907

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
TAGS
AUG Leaders

Atlassian Community Events