Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,254,211
Community Members
 
Community Events
164
Community Groups

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

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

0 votes
Darryl Lee Community Leader Apr 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.

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 ;)

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

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

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
Community showcase
Published in Jira Software

Upcoming changes to epic fields in company-managed projects

👋 Hi there Jira Community! A few months ago we shared with you plans around renaming epics in your company-managed projects. As part of these changes, we highlighted upcoming changes to epics on...

1,364 views 10 22
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you