I'm having some difficulty creating a repo under a workspace using the cloud API through a repo setup script. This is the curl command:
curl --request POST \
--url "https://api.bitbucket.org/2.0/repositories/${workspace}/${repo_slug}" \
--header "Authorization: Bearer ${BITBUCKET_REPO_SETUP}" \
--header "Accept: application/json" \
--header "Content-Type: application/json" \
--data "{
\"type\": \"repository\",
\"name\": \"${repo_slug}\",
\"project\": {
\"key\": \"${PROJECT_KEY}\"
}
}"
When I execute this command I get the following error:
{
"type": "error",
"error": {
"message": "You do not have access to view this workspace."
}
}
This is seemingly a permission issue, so the first thing I did was check the project access token's permissions. I verified it has the correct permissions:
When I execute a GET request with the same token to the same workspace I get a successful response:
curl --request GET \
--url "https://api.bitbucket.org/2.0/workspaces/${workspace}" \
--header "Authorization: Bearer ${BITBUCKET_REPO_SETUP}" \
--header "Accept: application/json"
What am I missing?
G'day, @Ryan Mangum
Welcome to the community!
Are you an administrator of the workspace with the ability to create a repository through the user interface? If so, which type of token did you use to create the repository? There are three types of tokens available: the Workspace token, the Repository token, and the Project token, which is referred to as the Bitbucket Access Token.
If you do not have administrative privileges in the workspace, it is expected that you won't be able to create a repository due to insufficient permissions hence the error
You do not have access to view this workspace
You need to request your administrator to provide you with access to create a repository to allow you to create a repository.
I hope this helps.
Regards,
Syahrul
I am an administrator for the project, and the request above is being sent with a project level access token. Just so I understand, I cannot create a repo within a project that I have an admin token for, and I will need a workspace admin token to do this?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Ryan Mangum
It looks like there's a bug with the Project access token with the create repository endpoint that is currently tracked at:
https://jira.atlassian.com/browse/BCLOUD-22568
Please Vote and Watch the bug report so that you'll receive an update whenever it's fixed.
As a workaround, please use App Password instead temporarily.
I hope this helps.
Regards,
Syahrul
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.