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??
In the bottom right of each page Jenkins has a link to their REST API. This link will appear on every page of Jenkins and points you to an API output for the exact page you are browsing. That should provide some understanding about how to build the API URLs.
The simplest way to access Jenkins REST API is to gather the User Token which is available by selecting your User and clicking on Configure. Now you will use the token as parameter for your authentication.
(Required) Select the service connection for your Jenkins instance. To create one, click the Manage link and create a new Jenkins service connection. (Required) The name of the Jenkins job to download artifacts from. This must exactly match the job name on the Jenkins server.
you mean this?
http://jenkins/job/myjob/../api/json?tree=artifacts[*]
Reference: Click here
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".
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