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?
Bamboo REST APIs provide access to resources (data entities) via URI paths. To use a REST API, your application will make an HTTP request and parse the response. By default, the response format is XML. If you wish, you can request JSON instead of XML.
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.
There are some issues related to your question: https://jira.atlassian.com/browse/BAM-11706 and BAM-16315 (which was deleted, because it contained customer details)
Here is the rest api documentation
https://docs.atlassian.com/atlassian-bamboo/REST/latest
Search for "/latest/result" documentation
http://myhost.com:8085/rest/api/latest/result/{projectKey}-{buildKey}-{buildNumber : ([0-9]+)|(latest)} [GET]
Example xml request
https://bamboo.server.com/rest/api/latest/result/projectKey-buildKey-buildNumber?expand=artifacts
Example json request
https://bamboo.server.com/rest/api/latest/result/projectKey-buildKey-buildNumber.json?expand=artifacts
Parse the artifacts node in the response. Each artifact should have an href property. Pass the href to curl to download the artifact. You will probably need to setup a Bamboo token for rest api authentication.
Example curl request
curl -X GET -H "Authorization: Bearer ${BAMBOO_TOKEN}" $ARTIFACT_HREF
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With