Bootstrap FreeKB - Bamboo - Getting Started with the Bamboo REST API
Bamboo - Getting Started with the Bamboo REST API

Updated:   |  Bamboo articles

In the Bamboo web console, navigate to Profile > Personal access token > Create token and create your access token.

 

You could then use curl to submit a GET request to the /rest/api/latest/project endpoint, using your access token, and replacing "bamboo.example.com" with the DNS hostname or IP address being used for Bamboo in your organization.

~]$ curl --silent --insecure --header "Content-Type: application/xml" --header "Authorization: Bearer MzYwMDgxMzg1NzI2OskFoaK0TJ8O8dKkd9GiHBUzDuy7" --request GET --url https://bamboo.example.com/rest/api/latest/project

 

Something like this should be returned.

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<projects expand="projects">
  <link href="https://bamboo.example.com/rest/api/latest/project" rel="self"/>
    <projects expand="project" start-index="0" max-result="25" size="678">
      <project key="foo" name="foo" description="">
        <link href="https://bamboo.example.com/rest/api/latest/project/foo" rel="self"/>
      </project>
      <project key="bar" name="bar" description="bar">
        <link href="https://bamboo.example.com/rest/api/latest/project/bar" rel="self"/>
    </project>
  </projects>
</projects>

 

By default, 25 results will be returned. max-results can be used to specify how many results you want to return.

~]$ curl --silent --insecure --header "Content-Type: application/xml" --header "Authorization: Bearer MzYwMDgxMzg1NzI2OskFoaK0TJ8O8dKkd9GiHBUzDuy7" --request GET --url https://bamboo.example.com/rest/api/latest/project?max-results=1000

 

You can include the project key to return the XML for a specific project.

curl --insecure --silent --header "Content-Type: application/xml" --header "Authorization: Bearer MzYwMDgxMzg1NzI2OskFoaK0TJ8O8dKkd9GiHBUzDuy7" --request GET --url https://bamboo.example.com/rest/api/latest/deploy/deploy/project/foo

 

If the key matches a project, the XML for the project should be displayed.

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<project expand="plans" key="foo" name="foo" description="">
  <link href="https://bamboo.example.com/rest/api/latest/project/foo" rel="self"/>
  <plans start-index="0" max-result="25" size="27"/>
</project>

 




Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee



Comments


Add a Comment


Please enter d4b2ae in the box below so that we can be sure you are a human.