How to get a list of plan repositories by using Bamboo Data Center REST API

Still need help?

The Atlassian Community is here for you.

Ask the community

Platform Notice: Data Center - This article applies to Atlassian products on the Data Center platform.

Note that this knowledge base article was created for the Data Center version of the product. Data Center knowledge base articles for non-Data Center-specific features may also work for Server versions of the product, however they have not been tested. 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

The steps outlined on this article are provided AS-IS. This means we've had reports of them working for some customers — under certain circumstances — yet are not officially supported, nor can we guarantee they'll work for your specific scenario.

You may follow through and validate them on your own non-prod environments prior to production or fall back to supported alternatives if they don't work out.

We also invite you to reach out to our Community for matters that fall beyond Atlassian's scope of support!

Summary

This article provides detailed instructions on how to obtain a list of repositories associated with a specific plan in Bamboo Data Center using the REST API.

Environment

The solution has been validated in Bamboo Data Center 9.4 but may be applicable to other versions.

Solution

Bamboo currently lacks a dedicated REST API endpoint to directly retrieve only the repositories of a plan, as outlined in BAM-25891 - Getting issue details... STATUS . However, you can use an alternative REST endpoint to obtain this information.

To retrieve a list of repositories for a specific Bamboo plan, you can use the Get plan {projectKey}-{buildKey} specs API. Follow the instructions below using either Bash or PowerShell, depending on your environment:

Bash
curl -s -k -X GET -H 'Accept: application/json' -H 'Authorization: Bearer <personal token>' "https://bamboo.mydomain.net/rest/api/latest/plan/PROJ-PLAN/specs?format=YAML" | jq -r '.spec.code' | yq e '.repositories[] | keys | .[]'
PowerShell
(Invoke-RestMethod -Uri "https://bamboo.mydomain.net/rest/api/latest/plan/PROJ-PLAN/specs?format=YAML" -Headers @{ "Accept" = "application/json"; "Authorization" = "Bearer <personal token>" } -Method Get).spec.code | ConvertFrom-Yaml | ForEach-Object { $_.repositories | ForEach-Object { $_.PSObject.Properties.Name } }

Replace <personal token> with your actual personal access tokens, and PROJ-PLAN with your specific project and plan keys.

The above commands assume you have the necessary tools (curl, jq, yq for Bash, or Invoke-RestMethod for PowerShell) installed and available in your PATH.

By following these steps, you can successfully retrieve a list of repositories associated with a specific Bamboo plan.

Last modified on Feb 21, 2025

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.