#
Run a Jenkins Job through an API
This tutorial explains to you how to call a Jenkins job through an API.
#
Allow the job to be run through an API
In order to allow the job to be run through an API, from the Dashboard, we need to click on the job name:
We will see a page like this:
We will click on "Configure" in order to configure the job. Click on "Build Triggers" and you will see something like this:
Check "Trigger builds remotely" and you will see something like that:
Enter a token for your API call, as in the picture above and click on "Save" button. Now we are ready to run the job remotely.
#
Run the Jenkins Job through an API
To run the job it is an easy task. Just send a GET request to the Jenkins server.
This could be done from the browser by putting
JENKINS_URL/job/Compile_Run_Java_Application/build?token=TOKEN_NAME
in the address bar of the browser.
Take a look at my call:
Info
In my case I use the following link:
http://192.168.72.132:8080/job/Compile_Run_Java_Application/build?token=ABCabc
After that you can see in the Jenkins Console that the job has been run.