2

I'm trying to get the list of pull requests for a given git commit in Bitbucket. I can successfully curl both the commit, and the list of pull requests:

curl -u $USER:$APP_TOKEN https://api.bitbucket.org/2.0/repositories/meekrosoft/demo_bitbucket_pipe/commit/d7f5d5b11b268a70684f8683b411caed57da9d34/
curl -u $USER:$APP_TOKEN https://api.bitbucket.org/2.0/repositories/meekrosoft/demo_bitbucket_pipe/pullrequests

However when I try to get the pull requests for a commit that has an associated pull request I get a 400 error:

curl -u $USER:$APP_TOKEN https://api.bitbucket.org/2.0/repositories/meekrosoft-ztl/test_pipe/commit/d7f5d5b11b268a70684f8683b411caed57da9d34/pullrequests 
{"error": "Invalid or unknown installation"}%
mikelong
  • 3,694
  • 2
  • 35
  • 40

2 Answers2

1

It seems to be some kind of new feature that you can only select once you view a pull in the user interface

enter image description here

mikelong
  • 3,694
  • 2
  • 35
  • 40
  • Had a similar issue. Although I was visualising the PR and extracted the commit from there, only after going to the commit and click on the button (on the right panel) to jump to the pull requests, it unblocked the API – saamorim Apr 19 '23 at 17:16
1

Per the Bitbucket docs: https://developer.atlassian.com/bitbucket/api/2/reference/resource/repositories/%7Bworkspace%7D/%7Brepo_slug%7D/commit/%7Bcommit%7D/pullrequests

Pull Request Commit Links app must be installed first before using this API; installation automatically occurs when ‘Go to pull request’ is clicked from the web interface for a commit’s details.

I tried to do it in Chrome but it didn't work (console said something about CSP). I was able to do it in Safari and get this endpoint to work. You'll have to do this once per workspace.

Fathy
  • 4,939
  • 1
  • 23
  • 25