Hi,
I already managed to get http request working properly - but only with CSRF Protection turned off.
normal http request with cURL command + CRUMB is looking something like this:
curl -X POST -H "Jenkins-Crumb:2e03fc96f387abggga6581fe5883a14a" http://My-Jenkins:8080/view/phase_2/job/test_remote_api_triggerring/buildWithParameters?token=MY_TOK... --user "username:password"
In my vRO script the http request looks like this:
var jobRequest = restHost.createRequest("POST", jobUrlWithToken);
System.log("jobRequest: " + jobRequest);
System.log("jobRequest full Url: " + jobRequest.fullUrl);
var jobRequestRes = jobRequest.execute();
which makes the https request looks like this:
How and where should I placed the crumb token?
please help..
Hi,
Add the line:
jobRequest.setHeader("Jenkins-Crumb", "2e03fc96f387abggga6581fe5883a14a");
before the line:
var jobRequestRes = jobRequest.execute();
---------------------------------------------------------------------------------------------------------
Was it helpful? Let us know by completing this short survey here.
Hi,
Add the line:
jobRequest.setHeader("Jenkins-Crumb", "2e03fc96f387abggga6581fe5883a14a");
before the line:
var jobRequestRes = jobRequest.execute();
---------------------------------------------------------------------------------------------------------
Was it helpful? Let us know by completing this short survey here.
Helpful as always!
Many thanks!