Jenkins Remote Trigger Not Working

jenkins trigger build remotely with parameters
jenkins trigger builds remotely
jenkins json api
jenkins curl plugin
jenkins rest api get build status
jenkins rest api get job configuration
jenkins api create job
jenkins api client for java example

I am getting the following error when i try triggering a build using the following command:

curl http://jenkins_server:port/jenkins/job/job_name/build?token=token_name


Authentication required

<-- You are authenticated as: anonymous Groups that you are in:

Permission you need to have (but didn't): hudson.model.Hudson.Read ... which is implied by: ... which is implied by: hudson.model.Hudson.Administer ->

I have admin rights and have also enabled 'Authentication Token'. I also have Build, Discover and Read rights on Job. I am using Jenkins 1.614.

I did check several posts online but could not find anything that works for me. Tried few options such as 1) curl -X POST http://jenkins_server:port/jenkins/job/job_name/build?token=token_name 2) curl -u user:API (Prints a long HTML page)

Any suggestions.

I install Build Token Root Plugin to solve this issue before

Then as the same, setup Authentication Token

Finally, either use curl to trigger remote build (Be careful the escape character "\")

curl http://JENKINS_URL/buildByToken/build?job=JOB_NAME\&token=TOKEN_NAME

or paste the URL to your browser (No needs escape character "\")


If you see Succeed, it means that trigger remote Jenkins successfully.

Note that, you don't have to setup build, discover, and read rights on Job

For more information, you could reference to

Remote access API - Jenkins, retrieve information from Jenkins for programmatic consumption. trigger a new build; create/copy The depth control, introduced in 1.167, solves this problem. Configuration: Hudson is configured for internal user authentication, matrix-based security. As per bug 1555, if anonymous does not have overall read permission in addition to job/build, then remote trigger does not work, with or without token. If token is configured on a job,

[JENKINS-17764] 'Trigger Builds Remotely' with ?token not working , I have Global Security configured to use LDAP with "Project-based Matrix Authorization Strategy" enabled. Anonymous user has the "Job  It made sense in a time when Jenkins allowed anyone Read access to anything, but only authenticated users were able to trigger builds. With more complex security realms, that can limit Read access for some users, this scheme no longer works, as access to the entire /job/whatever/ URL space can be prohibited. This is pretty deep inside Jenkins, and there's nothing the authorization plugin can (or should) do.

I had the same problem after setting up a test Jenkins server. The solution was to authenticate using my Jenkins admin password:

curl -u admin:<mypassword> http://localhost:8080/job/Test/build?token=<mytoken>

Use the same username and password you use to login to Jenkins. There was no need to install additional plugins.

[JENKINS-51874] Parameterized Remote Trigger does not use URL , Jenkins ver 2.126 (local) and 2.118 (remote) Parameterized Remote Trigger Plugin ver 3.0.0. Build Token Root Plugin ver 1.4. Similar Issues: Remotely triggering Jenkins jobs. But, many a times we want to trigger the build from outside, without manually interacting with the web interface. The most common use cases are triggering a build from a scheduler or another automated job. Here in this post we’ll see how we can trigger a job on a remote Jenkins server.

I suggest you try Jenkins Python API. It provides an build_job action that is super easy to trigger a job.

build_job(name, parameters=None, token=None)
   Trigger build job.

   name – name of job
   parameters – parameters for job, or None, dict
   token – Jenkins API token

Triggering Jenkins builds by URL, As you might have read not too long ago, I recently moved my site from Having a Jenkins instance running turns out to be quite useful for all sorts of Under Build Triggers, check the box next to “Trigger Builds Remotely”. In an svn project where hudson's security is setup as "Matrix-based security", "Trigger builds remotely (e.g., from scripts)" does not work, even with with a specified "Authentication Token" UNLESS Anonymous "Read" has been selected in Hudson's Authorization.

How to not "fire and forget" when doing a remote trigger of a Jenkins , When setting up the remote trigger, you have to click "Block until the remote triggered projects finish their builds." Remote Parameterized Job. I have 2 Jenkins hosts, and would like First Jenkins to trigger a job on remote Jenkins based on "SUCCESS" in result on the first one. I have looked at various plugins , but they all seem to indicate ONE Jenkins host, where multiple jobs can be chained in this manner.

how to trigger jenkins job via curl command remotely, curl jenkins. I have tried to execute(trigger) jenkins job (not a parameterized job) via curl command by using below methods but it showing these results. my  At the moment (Jenkins 2.22) the "Trigger builds remotely" build trigger option is visible in the multibranch pipeline job configuration, but does not work (if you check it and specify a token, it gets reset after saving anyway). According to this, it is intentional that the trigger cannot be set, but a bug that it appears as an option at all.

Unable to get Remote build trigger working, I need to use curl to remotely trigger build for a project. curl -X POST http://​jenkins/job/projectname/build?token=tokenvalue --user username:apiToken I am able to login with that specific user in browser without problem. Hello there is a big problem with the remote api and the 302 redirection, we have a simple installation of jenkins, no proxies or firewalls, completely internal instance, and we try to trigger a job remotely on this Jenkins instance, sometimes it passes with 201 code or the server will respond with 302 code the trigger doesn't get invoked.

Trigger new build for Jenkins throws an exception · Issue #33 , But Trigger new build does nothing (after popup "Are you sure" is shown) and in the See:  The mechanics of this configuration work as expected at built time (ie: the correct / same revisions get checked out for each stage), however the polling mechanics don't work. For some reason changes to repos configured in this way always detect changes in them which causes builds to run over and over and over again, in perpetuity.

  • I was really frustrated trying out different things. I'm sure i saw this Token Root plugin suggestion on some other link as well and i did notice that the plugin was already installed on my system but looks like i overlooked the syntax that time. :( While reading your answer, somehow, i did notice the correct syntax. :P Thanks a lot man! :) Quite relieved! :)
  • thanks for pointing out the need for an escape char. that was missing for me.
  • I get same problem when trying to integrate gitlab and jenkins. I am using the gitlab inbuild feature to test push trigger. Which throws me the above error. What can be done to solve it in my case
  • @TaraPrasadGurung I had use GitLab to trigger Jenkins with webhook, everything go well. Could you describes in detail the error throws?
  • I get same problem when trying to integrate gitlab and jenkins. I am using the gitlab inbuild feature to test push trigger. Which throws me the above error. What can be done to solve it in my case
  • Worked for me when I provided a CSRF crumb header, detailed here;…
  • Since JenTing's suggestion worked for me, for now, i'll go for that but thanks for your suggestion! This API might come handy sometime. :)
  • The plugin is already installed and as i already mentioned in my post, i tried the suggested syntax but it's not working. I get the same error.