Bitbucket API giving 404?

Jonathan Kelley January 13, 2023

Trying to get started with the API. Something simple, like list projects, [api doc link]

 

It says GET 'http://{baseurl}/rest/api/latest/projects' 

 

Looking for baseurl, official docs say this "intro":

http://host:port/context/rest/api-name/api-version/path/to/resource

For example, the following URI would retrieve a page of the latest commits to the jira repository in the Jira project 

 

 
So when I try this for bitbucket:
https://bitbucket.org/rest/api/latest/projects << What the documentation would suggest should work  [api doc link]
It's all just 404.
Why is this resource not found?

2 answers

1 vote
Ulrich Kuhnhardt _IzymesCo_
Atlassian Partner
January 15, 2023

Hi Johnathan,

 

you're mixing Bitbucket cloud (bitbucket.org/...) with Bitbucket server/datacenter (yourdomain.com/....)

Bitbucket cloud (Atlassian hosts) is a different implementation with a different REST API compared to Bitbucket server/Datacenter (you host)

Here are the respective REST APIs

Server/DC : https://developer.atlassian.com/server/bitbucket/rest/v807/intro/

Cloud: https://developer.atlassian.com/cloud/bitbucket/rest/intro/

 

Hope that helps!

Happy coding, Ulrich

// Izymes - Bitbucket tools for busy teams

0 votes
Jonathan Kelley January 13, 2023

Also when looking into online examples, or examples within my own organization, here's what bitbucket API urls typically look like:

 curl https://api.bitbucket.org/2.0/repositories/{accountname}
 curl --user {accountname}:{app_password} https://api.bitbucket.org/1.0/user/
curl --user {accountname}:{app_password} https://api.bitbucket.org/1.0/repositories/{accountname}/{repo_slug}/issues  

 

Of course, these working URL scheme is not documented in the "intro" section: but it does vaguely conform to `http://host:port/context/rest/api-name/api-version/path/to/resource`

Jonathan Kelley January 13, 2023

However, starting with anyone elses working endpoint URL as an example does not work.

url = 'https://api.bitbucket.org/2.0/latest/projects' is yet another 404.
url = 'https://api.bitbucket.org/1.0/latest/projects' is yet another 404.


Is there a way to access this API resource? 
https://developer.atlassian.com/server/bitbucket/rest/v807/api-group-project/#api-api-latest-projects-get

The docs don't mention what version this resource version of the API is at currently  (1.0, 2.0), which seems a bit confusing as well.




Suggest an answer

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

Atlassian Community Events