Get Jenkins artifacts URl from REST api

12,962

Solution 1

you mean this?

http://jenkins/job/myjob/../api/json?tree=artifacts[*]

Reference: Click here

Solution 2

If you're using the ArtifactDeployer Plugin, then, unfortunately, the artifacts deployed through it won't be listed by the API.

The ideal solution, if you have the time for it, would be to mod the plugin and add an API to it.

In my case, due to time constraints, I had to scrape the page instead, by fetching the build's HTML page and picking up all the <a> tags whose href started with "deployedartifact/downloads".

Share:
12,962

Related videos on Youtube

New Developer
Author by

New Developer

C# application developer

Updated on June 04, 2022

Comments

  • New Developer
    New Developer almost 2 years

    Is there any way to get artifacts download url from jenkins REST API. I am using artifact deployer and artifacts can be download from

    http://localhost:8080/job/jobname/buildId/deployedartifact/downloads/artifacts.{id}
    

    Is it possible to get the url infomation from REST api??

  • Haroldo_OK
    Haroldo_OK over 8 years
    Not really; from the URL, he seems to be using some remote deployment plugin, in which case the deployed artifacts won't be listed as artifacts by the API.