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

Get UUID of all variables of repository

Satya Kesanakurty June 5, 2024

I need to get the UUID of all repository variables which is possible only through Bitbucket rest api. The requirement of this is I need to update variables using a script for which variable's UUID is must.

Here is my curl request:

curl --header 'Authorization: Bearer <access-token>' --header 'Accept: application/json' --url https://api.bitbucket.org/2.0/repositories/<workspace-name>/<repo-slug>/pipelines_config/variables/

"List Variables for a repository" API is giving values only for some variables. For the other variables, it is giving a next token.

Using next token, I am not able to list the other values. Here is how I tried:

curl --header 'Authorization: Bearer <access-token>' --header 'Accept: application/json' --url <next-token>

I am getting errors when trying to do it:

```

<HTML><HEAD><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<TITLE>ERROR: The request could not be satisfied</TITLE>
</HEAD><BODY>
<H1>403 ERROR</H1>
<H2>The request could not be satisfied.</H2>
<HR noshade size="1px">
Bad request.
We can't connect to the server for this app or website at this time. There might be too much traffic or a configuration error. Try again later, or contact the app or website owner.
<BR clear="all">
If you provide content to customers through CloudFront, you can find steps to troubleshoot and help prevent this error by reviewing the CloudFront documentation.
<BR clear="all">
<HR noshade size="1px">
<PRE>
Generated by cloudfront (CloudFront)
Request ID: some-id
</PRE>
<ADDRESS>
</ADDRESS>
</BODY></HTML>

```

Not sure why there isn't any proper documentation for these type of actions in Bitbucket. Bitbucket documentation is not clear at all.

Please help me with this.

 

Thanks in advance!

2 answers

1 accepted

0 votes
Answer accepted
Ben
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 5, 2024

Hi Satya,

You can use the pagelen parameter to increase the output that is displayed in a single page, for example:

https://api.bitbucket.org/2.0/repositories/<workspaceID>/<reposlug>/pipelines_config/variables?pagelen=100

If there is still another page of results, you can add the page parameter to display these results:

https://api.bitbucket.org/2.0/repositories/<workspaceID>/<reposlug>/pipelines_config/variables?page=2

I hope this helps.

Cheers!

- Ben (Bitbucket Cloud Support)

Satya Kesanakurty June 5, 2024

Hi Ben!!

Thank you very much for your help.

It works.

 

Thanks!!

Surendhiran Balaguru September 2, 2024

Hi Ben,

is there any way to get the uuid for deployment_config/variables through python

https://api.bitbucket.org/2.0/repositories/<worksace_id>/{REPO_SLUG}/deployments_config/environments/

I wanted to get the deployment values UUID and then need to update few of the existing values


0 votes
Shashank Sharma July 10, 2024

@Ben I am running this command but no luck 
- curl --user name:Pass--header 'Accept:application/json' --url https://api.bitbucket.org/2.0/repositories/name/repoSlug/pipelines_config/variables?pagelen=100 -H 'Content-Type:application/json'

 

Getting this error:
{"type": "error", "error": {"message": "Resource not found"}}
I tried on another project and was able to see the results

Ben
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
July 10, 2024

Hi @Shashank Sharma 

Can you try this? I've tested on my own repository and it works without issues:

curl --request GET \
  --url 'https://api.bitbucket.org/2.0/repositories/workspaceID/repositoryslug/pipelines_config/variables?pagelen=100' \
  --user username:AppPassword

Cheers!

- Ben (Bitbucket Cloud Support)

Shashank Sharma July 11, 2024

Hey @Ben getting the following response although I have admin access to the repo and has provided all possible permissions to the Access token as well still no luck 


Screenshot 2024-07-11 120005.png

Shashank Sharma July 11, 2024

I found the issue it was my access issue got elevated access to run the command Thanks @Ben 

Suggest an answer

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

Atlassian Community Events