I'm trying to retrieve the environment with the slug "production" with this request
http --verbose --auth username:app_password "https://api.bitbucket.org/2.0/repositories/org/repo/environments" q=="slug = \"production\""
which makes the following request:
GET /2.0/repositories/org/repo/environments?q=slug+%3D+%22production%22 HTTP/1.1
Accept: */*
Accept-Encoding: gzip, deflate
Authorization: Basic my_auth
Connection: keep-alive
Host: api.bitbucket.org
User-Agent: HTTPie/3.2.2
but instead of returning only the matching environment, the request returns all environments ignoring the filter.
Because the documentation [1] doesn't specify which filters are usable, I've tried to guess the request from the generic filter documentation [2], without success apparently
2. https://developer.atlassian.com/cloud/bitbucket/rest/intro/#filtering
Community moderators have prevented the ability to post new answers.
Hi Davide,
I'm afraid that the environments endpoint does not support filtering at the moment.
What you could do is save the output of the API call in a file and then use another tool that filters JSON data (for example, jq is one such tool) to get the environment you want.
We have a request to support filtering for this endpoint: https://jira.atlassian.com/browse/BCLOUD-22285
You can add your vote to it (by selecting the Vote for this issue link) to express your interest.
Kind regards,
Theodora
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.