I am currently encountering an issue when attempting to fetch repository environment variables as part of updating their values.
Creation of Values: I can successfully create environment variables using the provided UUID.
Fetching UUIDs: However, I am unable to retrieve the UUID value via the API GET request. The request returns a 404 error with the following message:
"There is no API hosted at this URL.\n\nFor information about our APIs, please refer to the documentation at: https://developer.atlassian.com/bitbucket/api/2/reference/"
Since I need to update multiple values in multiple environment values based on env_name
in the repository (there are many, so I am aiming for automation), I am facing this challenge.
USERNAME = 'xxyy'
PASSWORD = 'xxxxyyyyy'
WORKSPACE = 'workspace'
REPO_SLUG = 'repo-name'
url = "https://api.bitbucket.org/2.0/repositories/{WORKSPACE}/{REPO_SLUG}/deployments_config/environments"
# Headers for authentication
headers = {
'Authorization': f'Bearer {PASSWORD}'
}
# Make the GET request
response = requests.get(url, auth=(USERNAME, PASSWORD), headers=headers)
if response.status_code == 200:
# Parse the JSON response
data = response.json()
# Extract and print the repository names
print(json.dumps(json.loads(response.text), sort_keys=True, indent=4, separators=(",", ": ")))
Are you trying to use this API?
If so I think you need to drop the /deployments_config part of the URL, it's just /environments at the end:
https://api.bitbucket.org/2.0/repositories/{workspace}/{repo_slug}/environments
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.