oauth_resp=$(curl -X POST -u "mykey:mysecret" https://bitbucket.org/site/oauth2/access_token -d grant_type=client_credentials)
curl "https://api.bitbucket.org/2.0/repositories/myworkspace/mytestrepo/deployments_config/environments/{4d857618-d89d-4c4d-92a5-af70e46e4e9f}/variables" \ --request GET \ --header "Content-Type:application/json" \ --header "Authorization: Bearer $oauth_token"
UUID for the environment was got through a different GET so it's correct afaik.
response is
{"error": {"message": "Bad request", "detail": "Unexpected response body", "data": {"key": "unexpected.response.body", "arguments": {}}}}%
What I actually want to do is post deployment environment variables but that doesn't work either.
Status: 404 Headers: {'Server': 'nginx', 'Cache-Control': 'max-age=900', 'Content-Type': 'application/json; charset=utf-8', 'Strict-Transport-Security': 'max-age=31536000; includeSubDomains; preload', 'Date': 'Sun, 08 Mar 2020 19:30:35 GMT', 'X-Served-By': 'app-1129', 'X-Static-Version': 'a856747ae2e5', 'ETag': '"d8570ff7a4314593e35e9bc69e81400a"', 'X-Render-Time': '0.0081090927124', 'Connection': 'Keep-Alive', 'X-Version': 'a856747ae2e5', 'X-Request-Count': '2694', 'X-Frame-Options': 'SAMEORIGIN', 'X-Cache-Info': 'caching', 'Content-Length': '52'} Error Response: b'{"type": "error", "error": {"message": "workspace"}}
API 2.0 seems to work fine for the more common get/post but fails on the less common requests. I say "less common" because the documentation is rubbish on deploy and repository variables and so I assume that no one wants to automate those things