Hello
I try to makt the first steps with the Bitbucket API but i fail by the first step. (Frustration is maixmal)
I try to make ue the sample of the documentation and try to use the curl-command:
curl -H "Authorization: Bearer ATATT..." https://api.bitbucket.org/2.0/repositories/<emailadress X>/<repositoryname>/commits
The result is: Token is invalid or not supported for this endpoint
So how i get the API token:
After i logged into bitbucket with user X, i went to the gear in the top right corner. there i went to "Atlassian account setting" and there to the security tab. on this page i was then able to access the API token creation & management page. I then generated the API token there and used it for the curl command.
I made the token url-capable beforehand (mapped the characters url-compliant). I used exactly the same email address as I used to create the api token.
What am I doing wrong here?
Best regards
Lorenzo
G'day Lorenzo!
Welcome to the Bitbucket Cloud community :)
The URL format for API calls against our endpoints actually requires the use of your workspaceID for the repository path rather than your email address, and the call will fail if this is not followed - you can find the repository path via the URL reported in your browser when you browse the repository in question:
https://api.bitbucket.org/2.0/repositories/<workspaceID>/<repositoryname>/commits
I have tested using my own repository and was able to query against it with the use of a bearer token, here is an example of the command that I executed:
curl --request GET \
--url https://api.bitbucket.org/2.0/repositories/<workspaceID>/<repositoryname>/commits \
--header 'Authorization: Bearer hunbYYd.........'
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.
Please raise a new post, this post that you've replied to is 2 years old and we are not able to access your details to assist you with troubleshooting as a result.
Thanks,
- 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 , 👋
created a new thread on the same posted here as well since if by any chance can I get response
I’ve been trying to add GPG using the REST API. I’ve tried creating an app password from my personal settings and checking on the organisation level to get the API key with the scope account:admin. However, when I give the user’s UUID, I always get the same response: “getting invalid token or not supported endpoint”.
Here’s the link to the API documentation: https://developer.atlassian.com/cloud/bitbucket/rest/api-group-gpg/#api-group-gpg
Could you please suggest a proper REST API that we can use? We’ve enabled signed commits, and we want to automate the process of adding GPG keys and making signed commits using Jenkins. Additionally, we’d like to be able to delete signed commits every time. Since docket agent tries to create gpg key every time during the launch with Jenkins
Many thanks in advance
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.