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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root


1 badge earned


Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!


Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.


Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!


Updating repository variables via pipeline


Problem: we want to update our version number in the pipeline when it runs successfully. We currently pull the version number from the repo's env variables and after a build it should change the variable .

So I was looking at the api and have this:


curl --request PUT \
--url '{wksp}/{repo}/pipelines_config/variables/{uuid}' \
--user 'user:pwd' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data '{
"type": "pipeline_variable",
"uuid": "{uuid}",
"key": "VERSION",
"value": "0.0.0-TEST"

However I get a

{"error": {"message": "Bad request", "detail": "Unexpected response body", "data": {"key": "unexpected.response.body", "arguments": {}}}}

I have tried multiple configurations. This is straight from the API docs.

Note that getting the variable works. And I have matched the fields from that.

Thank you!



1 answer

0 votes
Patrik S
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
Nov 16, 2023

Hello @Meagan Hiatt 

and thanks for reaching out to Community!

The update an environment variable API endpoints expect the variable_uuid in the URL path, and since this UUID contains curly braces, the value in the URL must be URL-encoded.

I was able to reproduce the same error you were receiving when I tried to provide the UUID unencoded in the format {12345678-abcd-1234-abcd-1234abcd1234}.

The encoding values (see URL encoding reference) of curly braces are as follows  : 

  • {   -  %7B
  • }   -  %7D

And the encoded URL will look like the below :

With %7B and %7D added to the beginning and end of the variable UUID, respectively.

Example curl request : 

curl --request PUT -u 'USERNAME:APP_PASSWORD' '' --header 'Content-Type: application/json' --header 'Accept: application/json' --data '{

"type": "pipeline_variable",

"uuid": "{12345678-abcd-1234-abcd-1234abcd1234}",

"key": "MY_VAR",

"value": "123"


Hope that helps! Should you have any questions or run into any issues trying the suggestion above, feel free to ask :) 

Thank you, @Meagan Hiatt !

Patrik S 

Suggest an answer

Log in or Sign up to answer
AUG Leaders

Atlassian Community Events