-2

I want to update jenkins job without restarting the jenkins. For that I am using jenkins REST API in my java code. But because of CSRF security I am not able to POST anything to jenkins URL. By using crumbIssuer this can be done. Can anyone help me with crumbissuer ?

Kruti Vyas
  • 63
  • 1
  • 7

1 Answers1

0

To use Rest api to update the job of a CSRF secured jenkins, we need to issue a crumb. To issue crumb the following rest api is used: http://hostname:port/crumbIssuer/api/json

it will return a jason having 3 key value pairs : _class crumb crumbRequestField

Set request header for post as crumbRequestField and the value as crumb. Then it will be able to connect.

Kruti Vyas
  • 63
  • 1
  • 7