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?
Community moderators have prevented the ability to post new answers.
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
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.