0
You don't make any mention of the language you want to use to consume the Jenkins API so I will talk specifically about the HTTP requests to the BitBucket API:
If you have a BitBucket Repository that has three commits in in it the first and the last are failing the build, the middle is passing:
...