REST API question (canceled builds)

I am trying to accomplish what I believe should be a simple task via the REST API and am running into a wall.

My goal is simply to get a list (or count) of build configurations whose most recent status is other than "success" via the REST API.  Optimally, the query would be limited to active (non-archived) configurations, but that additional filter is only a secondary goal.

I originally used the following REST API call in an attempt to glean this information:


Unfortunately, that call omits builds that failed with statues "error".  Thus, I thought that I could add some sort of Boolean "or" condition to that "status" filter, but no joy.  The API does not support multiple conditions for that field.

Thus, I modified my application to call the server twice, the second time using this API call:


That "two API call" approach seemed to work fine, but today I realized that I am still missing a condition.  One of my configurations is reporting an error, but the prior status was not "success" was "canceled".  Thus, neither API call listed above returns any results since the prior status was not "success"...and my application thinks life is great.  It is not.  

I looked into adding a Boolean "or" for the "status" value in the "sinceBuild" group, but again, no joy.  Thus, I thought that my application would now need to make two more calls to the server:


Unfortunately, "canceled" does not appear to be a valid status.

Is there really no simple (and reliable) way to call the server via the REST API and determine if the most recent status of each build configuration is other than "success"?  I understand that I could use the more rich portions of the API to get a list of all the configurations and then start walking them, but I wanted to check first to see if I am missing an obvious alternative.



1 comment
Comment actions Permalink

BTW, a couple of other related observations - this call shows that the status of canceled builds is listed as "unknown":

http://myserver:8080/guestAuth/app/rest/builds/?locator=buildType:<build id>,canceled:all

And you can execute this call to just retrieve builds with status "unknown":


But, neither of these calls are valid:


Whereas the same two calls with "sinceBuild:(status:success)" are valid.

While I would like to achieve my initially stated goal with a single API call, I am prepared to make multiple calls if necessary...and I don't understand why "unknown" is not a valid status value for sinceBuild if the server reports "unknown" as a status.  This seems like a bug.  Actually, the fact that a canceled build is reported as status "unknown" rather than "canceled" also seems like a bug.


Please sign in to leave a comment.