Hello! I've created a access token with full permission as you can see bellow:
I'm trying to list Environment variables with the code example of
https://developer.atlassian.com/cloud/bitbucket/rest/api-group-pipelines/#api-repositories-workspace-repo-slug-deployments-config-environments-environment-uuid-variables-get where I see that I supposedly have the right scopes but have this error:
Just in case I'm writing the code bellow. The env_uuid was gotten with list environment
# This code sample uses the 'requests' library:
# http://docs.python-requests.org
import requests
import json
workspace = 'gvcorppy'
repo_slug = 'mlendpoint-template'
url = f"https://api.bitbucket.org/2.0/repositories/{workspace}/{repo_slug}/deployments_config/environments/{dev_env_uuid}/variables"
headers = {
"Accept": "application/json",
f"Authorization": "Bearer {access_token}"
}
response = requests.request(
"GET",
url,
headers=headers
)
print(json.dumps(json.loads(response.text), sort_keys=True, indent=4, separators=(",", ": ")))
The access key is correctly configured because I used it in the same way to list the environments
Welcome to the community, @Francesco Camussoni
Looking at your screenshot, I think you mean to do something more like:
headers = {
"Accept": "application/json",
"Authorization": f"Bearer {access_token}"
}
You're treating the hash key as an f-string, but I'm sure you mean that to be the hash value instead.
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.