How to use the max-results API parameter for Bamboo REST API
Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.
Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Summary
This article explains how to use the max-results parameter in the Bamboo REST API. The max-results parameter is a query parameter used to limit the number of items returned in a Bamboo REST API response, and it is used to control pagination when retrieving large amounts of data. The article provides an example of how to use the max-results parameter to retrieve build results for a specific plan in Bamboo. It also highlights the importance of setting a reasonable value for max-results to avoid slow response times and high server load.
Environment
Applicable for all Bamboo versions.
Solution
By default, the Bamboo REST API returns a maximum of 25 items per response. If you want to retrieve more items, you can use the max-results parameter to increase the limit.
How to use max-results in Bamboo
To use the max-results parameter in Bamboo, you need to append it to the end of the REST API endpoint URL, as shown in the example below:
http://bamboo.example.com/rest/api/latest/plan?max-results=50
In this example, we are using the /plan endpoint to retrieve a list of plans, and we have set the max-results parameter to 50. This means that the Bamboo REST API will return a maximum of 50 plans per response.
To access all of the Bamboo APIs, you can refer to the documentation provided at https://docs.atlassian.com/atlassian-bamboo/REST/. This resource contains all the information you need to effectively integrate Bamboo's RESTful APIs into your projects and streamline your workflow.