background

Seejenkins Ofapi

Direct access JENKINS_URL/job/JOB_NAME/api/ You can viewjenkins Ofapi

build Onejob Words, yesPOST request JENKINS_URL/job/JOB_NAME/build

Will prompt:



This isjenkins Caused by the security policy of, Need to pass acrumb

 

  Resolvent

There are two options,

First option:

1. First remove.jenkins Security policy settings for, Pictured, Remove the check

stayjenkins In global security settings Cancel check “ Prevent cross Site Request Forgery(Prevent Cross Site Request Forgery exploits)”



2. allowanonymous Visit, Following chart, Checklist



3. Set uptoken,token Is for the specifiedjob Of, So go tojob Set up in



Then we can go throughPOST Request access JENKINS_URL/job/test1/build?token=TOKEN_NAME Trigger thisjob 了

 

 

Second option: Don't remove the security part to prevent cross Site Request Forgery, By passingcrumb To achieve; But allowanonymous Access or setup

 POST Bring this when you askJenkins-Crumb( This method is recommended)



  Visit JENKINS_URL/crumbIssuer/api/json You can get yourcrumb, Of course, different clients get different access



 

Remarks

In the textJENKINS_URL Replace with your ownjenkins address,

JOB_NAME replace withjob Name;

TOKEN_NAME Replace it with your owntoken value, Like the one above mejwentest1