Hi there!
All of my commits into main are tagged with their build number. eg build-1.0.2589
My prod env will always be a few commits behind dev, as new features get tested.
So for eg. prod = build-1.0.2539 and dev = build-1.0.2583. I am trying to get all the tags that are between prod and dev. So something like this:
https://api.bitbucket.org/2.0/repositories/{workspace}/{repo}/refs/tags?q=name>="build-1.0.2539"&sort=-name
Which should ideally return all those tag objects between dev and prod. Perhaps I should be filtering by date rather?
Thank you!
Hi Rio and welcome to the community!
You can filter by name with the operators >= will like this:
https://api.bitbucket.org/2.0/repositories/{workspace-id}/{repo}/refs/tags?q=%28name+%3D+%22build-1.0.2539%22+OR+name+%3E+%22build-1.0.2539%22%29
The query, without URL encoding, is (name=build-1.0.2539 OR name>build-1.0.2539)
Please keep in mind though that the name is a string and not a numeric value. If we assume that only the last 4 digits of the tag's name change, filtering like this should give you what you want up until the tag build-1.0.9999.
When you reach the tag build-1.0.10000 and the name in the API query is e.g. build-1.0.9960, then the API query won't return the tag build-1.0.10000.
Filtering by date sounds better for what you want to achieve, but it would need to be done on client side as this endpoint does not support filtering by date at the moment. We have a feature request that you can vote for to express your interest:
Kind regards,
Theodora
Hey Theodora. Yeah I think it makes much more sense to do the filtering on my end. Thanks for the help! All the best
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Another option would be to just do the filtering on the client side, if there is no other way to do it through the url.
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.