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.
env_name
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 authenticationheaders = { 'Authorization': f'Bearer {PASSWORD}' }# Make the GET requestresponse = 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 namesprint(json.dumps(json.loads(response.text), sort_keys=True, indent=4, separators=(",", ": ")))
Are you trying to use this API?
https://developer.atlassian.com/cloud/bitbucket/rest/api-group-deployments/#api-repositories-workspace-repo-slug-environments-get
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
This works great thank you
It looks like you're new here. Sign in or register to get started.