Missed Team ’24? Catch up on announcements here.

×
Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

BitBucket API to get Latest Tag on a particular branch

deepika dua
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
March 26, 2024

I want to get the latest tag on a particular branch.

For Example,

 for a branch release/fix,  there are n commits, but for each commit tags are not generated.

release/fix-   commit #111 

                     commit #110 - tag- 1.1.1

                     commit # 109 - tag 1.1.0

                    commit # 108 

 

So, latest tag would be 1.1.1 for  branch release/fix.

Need to get this via bitbucket api.

I want to get latest tag on branch release/fix. 

1 answer

1 accepted

1 vote
Answer accepted
Syahrul
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 27, 2024

G'day, @deepika dua 

Welcome to the community.

You can get this information via the List tags endpoint and use sorting to sort them for the latest created tags. You can check our page below to understand how to use sorting.

Sorting 

For example:

https://api.bitbucket.org/2.0/repositories/{workspace}/{repo}/refs/tags?sort=-date

Regards,
Syahrul

ccenvcvb March 28, 2024

I think the branch parameter is missing from this API, or can you use sorting to select the tags on a particular branch ?

 

I'm also interested in this question, on this risk of hijacking the OP's question I'd like to be able to get the result of `git describe` for a particular branch.

Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 29, 2024

Hi @deepika dua and @ccenvcvb,

I'm afraid that it is not possible to get that info via API, as our API doesn't return the branches that contain a certain commit or the result of `git describe` for a particular branch.

I can create a feature request for an API endpoint that returns the equivalent of `git describe` for a particular branch, for our development team to consider. Please feel free to let me know if you'd like me to do that.

Kind regards,
Theodora

ccenvcvb April 2, 2024

Please feel free to let me know if you'd like me to do that.

Yes please, I'd appreciate that.

Syahrul
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 2, 2024

Hey @ccenvcvb 

I have raised a feature request on behalf of you at:

https://jira.atlassian.com/browse/BCLOUD-23188

Please don't forget to Vote and Watch them so that you'll receive an update if it's being considered.

Regards,
Syahrul

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events