You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
Next: Root
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
The Atlassian Community can help you and your team get more value out of Atlassian products and practices.
I have Jira, Bitbucket Server, and Bamboo.
When I make a release, I would like automatically to stamp the release number as the Fix Version for all Jira issues detected in the release.
I found REST API endpoints for Jira that seems to be appropriate:
POST: /rest/api/2/version (to create a version)
PUT: /rest/api/2/issue/ISSUE-1 (to update the issue with new fixVersion)
But I can't find any REST API that gets a list of Jira issues related to a release.
I am flexible; we can work with the issues related to a given commit when Bamboo does the build, or we can look at the issues included when Bamboo makes a new release (i.e. since the last release). Either way will work for me.
What's the API to use?
Hi @shaulbehr
Firstly, this is the server API documentation which will become your friend if you're doing any API work.
/rest/api/2/search is probably the most flexible call for you to use, because you append ?jql= and then use any JQL you like. It could be sprint= or fixVersion= or created>"" - it's up to you to build a JQL which returns all items you're expecting.
Hi Warren, thanks for the reference!
I took a look at the search fields available, and there doesn't seem to be anything relating to either Git commits or Bamboo releases. I tried doing a search on the Jira website itself, and can't find anything relevant to search on. Did I miss something?
Anyway, I don't think the endpoint I want is going to be in the Jira API; it's more likely to be in Bitbucket or Bamboo. That's because my starting point is either a commit number (Bitbucket) or a release number (Bamboo), from which I want to retrieve the related Jira issues. I know it must be possible, because Bitbucket and Bamboo themselves show you very helpfully which Jira issues are linked to pull requests or new releases. I just need to find out what APIs they are using there.
Any ideas?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @shaulbehr
This is the Bitbucket server API and this is (I think) the cloud version. I have used both to get me successfully using the Bitbucket API.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
So I found this API being called in Bitbucket:
/rest/jira/latest/projects/LS/repos/my-proj/pull-requests/3772/issues
That's the kind of endpoint I'm looking for, though it's not exactly right, because this gives the issues per pull request, whereas I want the issues per commit. This also must exist, because I can see it on the "commit" screen, as highlighted below:
I looked in the developer tools and couldn't find the call that returns the issue numbers related to the commit, though.
What is the call?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Got it! It's this one:
At the bottom of the response is:
"properties": {
"jira-key": [
"LIGAPI-4352"
]
}
Thanks for your help!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.