Hi,
I'm trying to make use of the following endpoint:
to fetch a specific commit object and ideally its linked tag(s).
I noticed in the doc url above that the following information should be included in the response:
A ref object, representing a branch or tag in a repository.
For some reason, the responses I'm getting back do not include this piece of information. The same goes for the https://developer.atlassian.com/bitbucket/api/2/reference/resource/repositories/%7Busername%7D/%7Brepo_slug%7D/refs/tags#get endpoint where I'm fetching tags, the commit information is not included either.
After spending quite some time going through the docs as well doing some searches I'm not able to see what the reason for this would be. I'm having the impression that the response data works with some type of base type, so perhaps I need to send in some extra parameter that enables this extra piece of data.
Let me know if you require more information from my end,
Regards
Carlo
Hi @carlodesutter,
The first endpoint, /commit/<node>, doesn't return tags. Not sure why the documentation has that bit, we'll look into that.
The latter endpoint you mentioned is the right one to use. If you request /refs/tags without any parameters, you'll get a paginated list of all tags in your repository. Each item in the list will have commit hash in target.hash element. Example.
To find tag for specific commit(s) you can make use of BBQL, e.g. a query like target.hash="<commit_hash>" would do the trick for a single commit. Note that you need to URL-encode it. Example that fetches tags for two commits.
Lastly, you can ask for less or more data by passing fields parameter:
Let me know if this helps.
Cheers,
Daniil
Hi Daniil,
It looks like
https://api.bitbucket.org/2.0/repositories/{repo}/refs/tags?q=target.hash={sha1} is doing the trick
Thanks for your feedback
Kind regards
Carlo
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.