I can access the artifacts for a build using:
<PlanKey>?buildstate=Successful&max-results=1&expand=results.result.artifacts
Result something like:
...
However, is it possible then to download the artifacts from the artifact link result without resorting to some sort of HTML scraping?
Hello Ruban,
Thank you for your question.
This is the REST API call associated to Artifacts /plan/{projectKey}-{buildKey}/artifact which will provide you with the following output:
<artifacts expand="artifacts"> <link href="[bamboo-base-url]/rest/api/latest/plan/[projectKey]-[buildKey]/artifact" rel="self"/> <artifacts start-index="0" max-result="1" size="1"> <artifact> <id>1081345</id> <name>Greeting</name> <location/> <copyPattern>*.txt</copyPattern> <shared>true</shared> </artifact> </artifacts> </artifacts>
It will be required to iterate through the result(s) above and use it to build the URL to download the files.
If you find this answer useful, I would kindly ask you to accept it so the same will be visible to others who might be facing the same issue you have inquired.
Thank you for your understanding.
—
Kind regards,Rafael P. SperaficoAtlassian Support
OK I can see it will give the artifact but how can i use this to download all the artifacts associated with the plan?
In fact, how is this more useful than the original API url I was using in the question?
http://<URL>/rest/api/latest/result/<[projectKey]-[buildKey]>?buildstate=Successful&max-results=1&expand=results.result.artifacts
Hello Ruban, "-- However, is it possible then to download the artifacts from the artifact link result without resorting to some sort of HTML scraping?" No, as mentioned earlier, it will be required to write a script to loop trough the results and download the artifacts. — Kind regards, Rafael P. Sperafico Atlassian Support
Hi Rafael, this doesn't seem to work for me. http://builder:8085/rest/api/latest/plan/UTILS-SVNPERM/artifact?expand=artifacts should return my lone artifact definition but I get <artifacts expand="artifacts"><link href="http://builder:8085/rest/api/latest/plan/UTILS-SVNPERM/artifact"; rel="self"/><artifacts start-index="0" max-result="0" size="0"/></artifacts> Any clue what I'm missing?
Oh, that ONLY works for share artifacts.Verified by looking at source and experimentation. Ok, I must share my artifacts to be able to use this call
"It will be required to iterate through the result(s) above and use it to build the URL to download the files."
Exactly how to use the results to build the URL? What should go where?
so what url to use for downloading the artifacts in the loop ?
It looks like you're new here. Sign in or register to get started.