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!
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)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Ben,
is there any way to get the uuid for deployment_config/variables through python
I wanted to get the deployment values UUID and then need to update few of the existing values
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.