I am trying to filter & sort the deployments & environments rest api for bitbucket cloud but I am getting a 404 error below are the details.
This works
fetch('https://api.bitbucket.org/2.0/repositories/{workspace}/{repo_slug}/environments/', {method:'GET',
headers: {'Authorization': 'Basic ' + btoa('username:password')}})
.then(response => response.json())
.then(json => console.log(json));
This gives 404. The only difference is the querystring. I have tried various combinations of
fetch('https://api.bitbucket.org/2.0/repositories/{workspace}/{repo_slug}/environments?q=slug%3D%22canary-amr-qat-hardees%22', {method:'GET',
headers: {'Authorization': 'Basic ' + btoa('username:password')}})
.then(response => response.json())
.then(json => console.log(json));
Is filtering & sorting not supported on these endpoints?
Hello @Muffadal Hamid ,
Welcome to Atlassian Community!
I'm afraid that sorting and filtering are not supported for the environments endpoint.
However, we already have a feature request to implement that functionality, which you can check at the following link:
I would suggest you to add your vote there, since this helps both developers and product managers to understand the interest. Also, make sure you add yourself as a watcher in case you want to receive first-hand updates from that ticket. Please note that all features are implemented with this policy in mind.
While this feature is not implemented, you have the option to retrieve all environments via the API and then use another tool to filter JSON data, like jq, in order to filter the results.
Thank you, @Muffadal Hamid .
Kind regards,
Patrik S
Thanks, @Patrik S for your response. The link you have posted talks only about the "environments" endpoint. However, I am facing the exact same issue with the "deployments" endpoint below
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hey @Muffadal Hamid ,
Actually, the feature request BCLOUD-18729 covers both the /deployments and /environment endpoints.
You can check that the feature name is regarding the /deployments endpoint, and I have added a comment in the feature description to also mention the /environments endpoint that is having the same behavior and currently not allowing filtering and sorting.
Thank you, @Muffadal Hamid .
Kind regards,
Patrik S
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.