Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Update Repository Variable via REST returning 404, GET returns 200

John C June 10, 2020

I am attempting to update a pipeline variable using the REST API.

When I run the below GET curl command I receive a 200 response:

curl "https://api.bitbucket.org/2.0/repositories/{workspace}/{repository}/pipelines_config/variables/{UUID}" \
-H "authorization: Basic <token>"

The response indicates I have the right scope (pipeline:variable)

X-OAuth-Scopes: pipeline:variable, webhook, snippet:write, wiki, issue:write, pullrequest:write, repository:delete, repository:admin, project:write, team:write, account:write

 

However when I run either of the following PUT statement I receive a 404

curl "https://api.bitbucket.org/2.0/repositories/{workspace}/{repository}/pipelines_config/variables/{UUID}" \
-X PUT \
-d "{\"key\": \"VERSION\", \"value\": \"2\"}" \
-H "{'Content-Type': 'application/json'}" \
-H "authorization: Basic <token>"

 

curl "https://api.bitbucket.org/2.0/repositories/{workspace}/{repository}/pipelines_config/variables/{UUID}" \
-X PUT \
-d "{\"uuid\": \"{e0432975-d630-43a6-ae1f-fc763e225d9e}\", \"key\": \"VERSION\", \"value\": \"2\", \"secured\": false}" \
-H "{'Content-Type': 'application/json'}" \
-H "authorization: Basic <token>"

 

Given I receive a 200 and the object I am struggling to understand why I receive a 404 when I perform a PUT.

Does anyone have any suggestions?  I believe I am sending everything detailed in the documentation:

https://developer.atlassian.com/bitbucket/api/2/reference/resource/repositories/%7Bworkspace%7D/%7Brepo_slug%7D/pipelines_config/variables/%7Bvariable_uuid%7D?_ga=2.9386805.1498113289.1591731597-564959769.1588164046#put

1 answer

1 accepted

0 votes
Answer accepted
John C June 10, 2020

This is a permission issue, the App Account had the right permissions but the user did not have access to the repo.  Could do with the right response code being returned but hopefully this will help someone.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
TAGS
AUG Leaders

Atlassian Community Events