Update Pipeline Variable

Will Vachon August 9, 2021

I'm unable to successfully update a repository variable and not sure why it's not working.

I've been able to get all the necessary IDs and am making the following curl request:

curl -X PUT "https://api.bitbucket.org/2.0/repositories/{workspace}/{repository}/pipelines_config/variables/{variable_uuid}" -H 'Content-Type: application/json' -d '{"value":"{value}","key":"{name}"}'

from this I get:

{"type": "error", "error": {"message": "Resource not found"}}

Does anyone have any ideas what's missing as I've tried changing everything I can think of but with no luck

1 answer

0 votes
Caroline R
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 13, 2021

Hi, @Will Vachon! Welcome to the community! 

I tested this on my side and was able to update the repository variable using this curl request. These are the steps I have followed:

curl -X GET -u user_name:password https://api.bitbucket.org/2.0/repositories/{workspaceID}/{repository_name}/pipelines_config/variables/
curl -X PUT -u user_name:password "https://api.bitbucket.org/2.0/repositories/{workspaceID}/{repository_name}/pipelines_config/variables/%7B{variable_uuid}%7D" -H 'Content-Type: application/json' -d '{"value":"value_20","key":"key_20"}'

Could you please share the exact requests you have run to update your variables? With this information, I can further investigate what could be happening here.

Thank you! 

Kind regards,
Caroline

Will Vachon August 13, 2021

Hey @Caroline R

So turns out I was missing the username:password auth and works fine with that, thanks!

Is this required or is there any other form or authenticating this, I'm wanting to set this up within a pipeline script & would be preferable if it wasn't linked to a specific user.

Like Caroline R likes this
Caroline R
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 16, 2021

Hey, @Will Vachon

I'm glad to know this is working fine now! :) 

Answering your question, API calls will always require a password to authenticate. 

Kind regards,
Caroline 

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events