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 .
Oooh, this feature request has been around for a long time:
https://jira.atlassian.com/browse/JRASERVER-3855https://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":
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 @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
Oh, and always... there's an app for that. ;-}
https://marketplace.atlassian.com/apps/1215431/automated-release-notes-for-jira
I was using Henri's approach as the workaround.
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/python3import sys, requests, jsondef 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 Nonedef 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 issueTypeNamesdef 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
It looks like you're new here. Sign in or register to get started.