2 Replies Latest reply on Jul 2, 2019 7:33 AM by shaharsib

    Create Jenkins http request + Crumb

    shaharsib Novice

      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_TOKEN --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:

      http://My-Jenkins/job/Lease_Time_VCD_ENV/buildWithParameters?token=116985f3e7XXXXXXX45d279ee9f8&VAPP_NAME=sha&LEASE_TIME=-1&STORAGE_TIME=-1&USER=ssi&DELETE_ALL_VAPPS=false&VCD_ORG=Global

       

      How and where should I placed the crumb token?

      please help..