Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
0 / 0 points
Next:
badges earned

Your Points Tracker
Challenges
Leaderboard
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Recognition
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Kudos
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

How to add version numbers to all Jira issues in a release?

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?

1 answer

1 accepted

2 votes
Answer accepted
Warren Community Leader Jul 11, 2019

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?

Warren Community Leader Jul 11, 2019

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.

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:

2019-07-11 13_48_04-LightSail _ API _ bfaf95ed9e0 - Bitbucket.png

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?

Got it! It's this one:

/rest/api/1.0/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}

At the bottom of the response is:

"properties": {
"jira-key": [
"LIGAPI-4352"
]
}

Thanks for your help!

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Bamboo

Bamboo 101 Video

G’day Community! As we gear up to introduce Bamboo Data Center to the world, we wanted to make sure that we shared a bit more about Bamboo, the product. Our team has put together an overview video ...

223 views 4 6
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