Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get Jenkins artifacts URl from REST api

Tags:

rest

jenkins

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??

like image 366
New Developer Avatar asked Sep 05 '13 07:09

New Developer


People also ask

How do I find my Jenkins API URL?

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.

How do I access REST API Jenkins?

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.

How do I download Jenkins artifacts?

(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.


2 Answers

you mean this?

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

Reference: Click here

like image 89
anand Avatar answered Sep 24 '22 14:09

anand


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".

like image 23
Haroldo_OK Avatar answered Sep 24 '22 14:09

Haroldo_OK