Search code examples
restbamboocontinuous-delivery

Can I download Bamboo built artifacts using Bamboo Rest - API?


This page states:

Bamboo's REST APIs provide the following capabilities:

  • Retrieve the artifacts for a build.

and here I see the documentation:

http://myhost.com:8085/bamboo/rest/api/latest/plan/{projectKey}-{buildKey}/artifact [GET]

When I try this link with the bamboo server I have, like:

https://my.bamboo.server/rest/api/latest/plan/MY-PLAN/artifact

All I get is:

<artifacts expand="artifacts">
    <link href="http://my.bamboo.server/rest/api/latest/plan/MY-PLAN/artifact" rel="self"/>
    <artifacts start-index="0" max-result="0" size="0"/>
</artifacts>

So am I understanding the REST documentation completely wrong, or is there something wrong possibly with MY-PLAN and this link is supposed to provide me a war file as I expect?


Solution

  • I'm afraid you are misunderstanding the REST documentation; by "Retrieve the artifacts for a build", it means "retrieves information about the build artifacts defined for a given plan". As you have already seen, all you get back is an XML or JSON document describing the artifacts defined.

    If you want to download an actual build artifact, you'll need to write a script that uses /rest/api/latest/result/ to get the latest successful build info and, from that, form an actual download link to the artifact.