Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get build status of PR using BitBucket API?

Not getting Build job details/status of the PR when using Bitbucket API for any pull request

Here is my API URL:

https://example.com/rest/api/1.0/projects/{projectkey}/repos/{reposlug}/pull-requests/{pullrequestID}

How Build status looks like on GUI:

enter image description here

I also tried below methods to get the Build status but no luck

/rest/api/1.0/projects/{projectKey}/repos/{repositorySlug}/settings/pull-requests
/rest/api/1.0/projects/{projectKey}/repos/{repositorySlug}/settings/hooks

So I wanted to get whether build status of any PR whether it is Success or Fail

Thanks in Advance for your answers.

like image 929
Ash Avatar asked Oct 31 '25 09:10

Ash


1 Answers

The build status is on the commit, not on the PR. First you should find the latest commit of the source branch by calling /rest/api/1.0/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}. see the docs for more details

Once you have the commit id you can query the build-status api by calling /rest/build-status/1.0/commits/{commitId}. See the docs for more details

like image 82
Yuri G. Avatar answered Nov 02 '25 00:11

Yuri G.



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!