Roopendra
Roopendra

Reputation: 7776

How to fetch all Builds of a Plan in Bamboo REST API?

I am trying to fetch all builds of a Bamboo plan using the rest API. My plan has more than 25 builds but its giving me only 25 builds.

API URL: https://localhost:8085/rest/api/latest/result/PROJECTKEY-PLANKEY.json

As per the official documentation

The number of resources in returned lists is limited to 25, unless you specify max-result.

Hence, for the workaround, I thought I can fetch build size in first api call and pass size in the second api call as max-results parameter. So that it will give me all builds for a plan. But first API call giving me size 1 whereas the same is working for fetching project size.

API call to get the build size: (Not Working) https://localhost:8085/rest/api/latest/result/PROJECTKEY-PLANKEY.json?max-results=1

output: size=1, max-result=1 (Whereas plan has 33 builds)

expected output: size=33, max-result=1

https://localhost:8085/rest/api/latest/result/PROJECTKEY-PLANKEY.json?max-results=33

Working API to get the Project Size:

https://localhost:8085/rest/api/latest/project.json?max-results=1

output:size=30, max-result=1

My question here, Can we fetch all BUILDS of a PLAN? As by default it only fetches 25 builds. Or any workaround?

Update: I have posted same problem in Bamboo forum and they found this is an issue in Bamboo REST API.

Upvotes: 2

Views: 2936

Answers (1)

Vidish Datta
Vidish Datta

Reputation: 192

Unsure whether I am reading it right or there is a typo.

You are adding "s" in max-results at the end, as seen in your http URLs.

Upvotes: 1

Related Questions