Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Broken API links

John Lindahl May 31, 2019

When I do any API request to get info of my (pull requests) repos I get broken links in the responses to dig further down into the info.

 

curl -s --fail -u [username]:[password] 'https://bitbucket.org/api/2.0/repositories/[project]/[repository]/pullrequests?limit=100&state=OPEN'

 Results in the following typ of links (all of them are looking the same):

"commits": {"href": "https://bitbucket.org/!api/2.0/repositories/[project]/[repository]/pullrequests/[PR]/commits"}

 Notice the exclamation mark (!) before api/, this breaks any further curls to that endpoint. 

1: Why do I receive these broken links?

2: How do I fix these problems?

1 answer

1 accepted

0 votes
Answer accepted
Daniil Penkin
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 20, 2019

Hi @John Lindahl

The proper way to make REST API calls to Bitbucket is against api.bitbucket.org, e.g. your example would look like this:

curl -s --fail -u [username]:[password] 'https://api.bitbucket.org/2.0/repositories/[project]/[repository]/pullrequests?limit=100&state=OPEN'

Such call would return the links relative to the same domain – api.bitbucket.org.

 

As for the links you got back, they're in fact not really broken. What I mean is that exclamation mark is intended there and a curl for such URL would work. However, as I mentioned before, endpoints under bitbucket.org/api and bitbucket.org/!api are considered internal and shouldn't be used by external applications.

Hope this helps.

Cheers,
Daniil

John Lindahl June 20, 2019

Thank you for this clarification and I Will try it out!

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events