Last build status
Asked by Petros Diveris:

Is there any way of getting the status of a build using a public API? In other words, can we show green and red buttons indicating whether the last build of a project was successful or not?


Answers:
author: Steffen Opel _Utoolity_
body: You can `GET` this information from the [Bamboo REST API](https://developer.atlassian.com/bamboodev/rest-apis) - unfortunately its documentation leaves a bit to be desired still:

* While mentioned and linked on the [Bamboo REST Resources](https://developer.atlassian.com/display/BAMBOODEV/Bamboo+REST+Resources) page, it is easily overlooked that the inline information on that page itself is incomplete and only the *[API reference for your Bamboo version](https://docs.atlassian.com/bamboo/REST/) is the recommended source of information on Bamboo REST APIs.*
* Furthermore, while structurally similar, that API reference is also not entirely at the same level as the ones from [JIRA](https://docs.atlassian.com/jira/REST/latest/), [Confluence](https://docs.atlassian.com/confluence/REST/latest/) and [Bitbucket Server](https://developer.atlassian.com/bitbucket/server/docs/latest/reference/rest-api.html) in particular, and frequently lacks the request/response shapes for example.

REST resource {#toc-hId-1621646087}
-----------------------------------

That being said, you are probably looking for the [/rest/api/latest/result](https://docs.atlassian.com/bamboo/REST/5.9.4/#d2e40) resource and its various sub resources (the top of the page provides an easier overview of all those variations):
> Provide list of latest build results for top level plans visible for users.

Node.js module {#toc-hId--930510874}
------------------------------------

Alternatively you might want to check into Sebastiano Armeli's [bamboo-api](https://github.com/sebarmeli/bamboo-api) Node.js module, which wraps the Bamboo REST API to get the build status via [bamboo.getLatestBuildStatus(planKey, callback)](https://github.com/sebarmeli/bamboo-api#bamboogetlatestbuildstatusplankey-callback) (amongst other useful helper functions):

```
bamboo.getBuildStatus("PROJECT_KEY-PLAN_KEY/BUILD_NUMBER", function(error, result) {    if (error) {        console.log(error);        return;    }    console.log("Status of the build:", result);});
```


author: Petros Diveris
body: Hi Steffen,

I have to eat my own words. The call is available, once just has to... guess the end point!

<https://jiscdev.atlassian.net/builds/rest/api/latest/result>

(you will get a non autorised error but that's fine).


author: Petros Diveris
body: I am indeed looking for [/rest/api/latest/result](https://docs.atlassian.com/bamboo/REST/5.9.4/#d2e40) but on Atlassian's cloud hosted Bamboo. The only thing I've found that could be of any use is the RSS feed i.e. [https://jiscdev.atlassian.net/builds/rss/createAllBuildsRssFeed.action?feedType=rssAll\&os_authType=basic](https://jiscdev.atlassian.net/builds/rss/createAllBuildsRssFeed.action?feedType=rssAll&os_authType=basic)

Using a parser and checking the top one for each project one could perhaps produce a failed/success status. i have to admit that it is a rather tedious way of achieving something as trivial as a green/red button in the project's page. Quite frankly I do not know why this functionality isn't in there already.


Tags: cloud