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:
- repository
- repository:admin
- repository:delete
- repository:write
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?