When I use the API to get a list of Pull Requests with
https://bitbucket.org/api/2.0/repositories/<workspace>/<repo_slug>/pullrequests?access_token=sometoken I receive a 200 as a response.
Following the documentation I should do the same for a list of deployments or pipelines
But when I send by GET request I receive 404 instead and the message:
'There is no API hosted at this URL.\n\nFor information about our API\'s, please refer to the documentation at: https://developer.atlassian.com/bitbucket/api/2/reference/'
Please notice that the required path params in the documentation are username and repo_slug for both the deployments and pipelines. But it's not the same as stated in the list of endpoints.
Plus, what is the username? It says "The account". What account? And if it is really necessary where and how should I inform this?
Hello Victor,
I have checked and probably the URL you are using is wrong. Bitbucket V2 apis are hosted under https://api.bitbucket.org/2.0 url, while for the first call you are using https://bitbucket.org/api/2.0. I do not know, but probably that is an old implementation and works with the pull requests because there has been there for ages, while pipelines and deployments is something newer.
Try with this urls:
https://api.bitbucket.org/2.0/repositories/{workspace}/{repo_slug}/pipelines/
https://api.bitbucket.org/2.0/repositories/{workspace}/{repo_slug}/deployments/
The last slash is important, I think in my case it wasn't working for me due to not writing it.
Another thing, I see that you put the access token as query param. Where does that access token come from? Because as far as I know the auth info has to go in the request headers.
Hi @victorferreirait ,
It is only a guess based on the provided information.
The only difference between these endpoints is the "/" at the end of the deployments and pipelines endpoint.
- pullrequests: /2.0/repositories/{workspace}/{repo_slug}/pullrequests
- deployments: /2.0/repositories/{workspace}/{repo_slug}/deployments/
- pipelines: /2.0/repositories/{workspace}/{repo_slug}/pipelines/
If you don't add the / at the end of the URL for pipelines and deployments you would receive this response
curl -u jsgreccia:<myapppassword> https://api.bitbucket.org/2.0/repositories/<workspace>/<repo_slug>/pipelines -v
< HTTP/2 404
{"type": "error", "error": {"message": "Resource not found", "detail": "There is no API hosted at this URL.\n\nFor information about our API's, please refer to the documentation at: https://developer.atlassian.com/bitbucket/api/2/reference/"}}* Closing connection 0
If you add the "/" at the end
curl -u jsgreccia:<myapppassword> https://api.bitbucket.org/2.0/repositories/<workspace>/<repo_slug>/pipelines/ -v
< HTTP/2 200
I hope that is the issue, if not please provide more information. I would be happy to help.
Cheers
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Victor,
My colleague Iñigo Gonzalez saw your question and wanted to answer, but he's having issues with posting with his own account. Here's the answer he was gonna publish:
I have checked and probably the URL you are using is wrong. Bitbucket V2 apis are hosted under https://api.bitbucket.org/2.0 url, while for the first call you are using https://bitbucket.org/api/2.0. I do not know, but probably that is an old implementation and works with the pull requests because there has been there for ages, while pipelines and deployments is something newer.
Try with these urls:
https://api.bitbucket.org/2.0/repositories/{workspace}/{repo_slug}/pipelines/
https://api.bitbucket.org/2.0/repositories/{workspace}/{repo_slug}/deployments/
The last slash is important, I think in my case it wasn’t working for me due to not writing it.
Another thing, I see that you put the access token as query param. Where does that access token come from? Because as far as I know the auth info has to go in the request headers.
Hope this helps!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Spend the day sharpening your skills in Atlassian Cloud Organization Admin or Jira Administration, then take the exam onsite. Already ready? Take one - or more - of 12 different certification exams while you’re in Anaheim at Team' 25.
Learn more
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.