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

API call to repository details fails with UUID

Adam Leppek November 22, 2021

GET calls to the endpoint /2.0/repositories/{workspace}/{repo_slug} fail when you use a UUID for the repo slug:

{"type": "error", "error": {"message": "The requested repository either does not exist or you do not have access. If you believe this repository exists and you have access, make sure you're authenticated."}}

The UUID is surrounded by braces as directed. The workspace is verified to be correct (the lowercase name works in other API calls). This fails whether or not a slash is used at the end of the URL. 

The repo UUID was found with a call to /2.0/repositories/{workspace}, with the same user. User access to the repo was verified.

Please advise. 

2 answers

1 accepted

1 vote
Answer accepted
seanaty
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
November 22, 2021

It's likely you need to percent-encode the curly brackets {} which are %7B and %7D respectively.

Without encoding:

% curl 'https://api.bitbucket.org/2.0/repositories/atlassian/{5137f783-a12b-4958-a614-4a2af63fca20}' | jq . 
{
  "type": "error",
  "error": {
    "message": "The requested repository either does not exist or you do not have access. If you believe this repository exists and you have access, make sure you're authenticated."
  }
}

With encoding:

% curl 'https://api.bitbucket.org/2.0/repositories/atlassian/%7B5137f783-a12b-4958-a614-4a2af63fca20%7D' | jq . 

{
  "scm": "git",
  "website": "",
  "has_wiki": false,
  "uuid": "{5137f783-a12b-4958-a614-4a2af63fca20}",
  "fork_policy": "allow_forks",
  "full_name": "atlassian/atlassian-jwt-py",
  "name": "atlassian-jwt-py",
  "project": {

    "type": "project",
    "name": "Atlassian Connect",
    "key": "AC",
    "uuid": "{cc445f42-b2f8-4d69-bfd1-4e0047966e87}"
  },
  "language": "python",
  "created_on": "2016-06-29T15:49:21.227310+00:00",
  "mainbranch": {
    "type": "branch",
    "name": "master"
  },
  "workspace": {
    "slug": "atlassian",
    "type": "workspace",
    "name": "Atlassian",
    "uuid": "{02b941e3-cfaa-40f9-9a58-cec53e20bdc3}"
  },
  "has_issues": true,
  "updated_on": "2021-10-08T06:10:03.835470+00:00",
  "size": 688349,
  "type": "repository",
  "slug": "atlassian-jwt-py",
  "is_private": false,
  "description": "JWT (JSON Web Token) encoding & decoding library for Python 2 and 3. Extends pyjwt to include\r\nAtlassian's custom QSH (query string hash) claim."
}
Adam Leppek November 30, 2021

@seanaty I replaced the brackets with their URL codes and everything works fine. Thanks for the help!

0 votes
Caterina Curti
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
October 9, 2023

Hi all,

Here is an article I recently wrote that covers UUIDs, workspace names and repository slugs when working with Bitbucket:

Working with UUIDs and their curly brackets, workspace names or repository slugs in Bitbucket 


The file in the provided example (https://bitbucket.org/atlassian/forge-bitbucket-assign-pr-reviewer/src/main/src/index.js) shows how to fetch a repository with all its details given a workspace and repository UUID.

 

Hopefully, it provides some clarity.

Cheers,
Caterina

Suggest an answer

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

Atlassian Community Events