Hello, 

I used to be able to start a job with "buildWithParameters" using curl and 
to get a json response containing information such as the future build 
number (nextBuildNumber) and the queueItem. Without changing anything I am 
not receiving the response body any more. I didn't use this code for quite 
some time, thus jenkins was updated meanwhile. I see that the response 
header contains a location that actually contains the queueId. 

Was there a change in the API ? 

Am I doing something wrong ? 

Here is the curl code equivalent to what I do in PHP : 
curl -v --user user:password -k -X POST -H "Content-Type: application/json" 
-d '{"module":"amoreTST"}' https:
//localhost/jenkins/job/AMORE-single-module/buildWithParameters

And the response : 
* About to connect() to localhost port 443 (#0)
*   Trying HIDDEN... connected
* Connected to localhost (HIDDEN) port 443 (#0)
* Initializing NSS with certpath: sql:/etc/pki/nssdb
* warning: ignoring value of ssl.verifyhost
* skipping SSL peer certificate verification
* SSL connection using TLS_DHE_RSA_WITH_AES_256_CBC_SHA
* Server certificate:
*     subject: HIDDEN
*     start date: May 06 12:10:48 2014 GMT
*     expire date: Nov 02 12:10:48 2014 GMT
*     common name: HIDDEN
*     issuer: HIDDEN
* Server auth using Basic with user 'HIDDEN'
> POST /jenkins/job/AMORE-single-module/buildWithParameters HTTP/1.1
> Authorization: Basic HIDDEN
> User-Agent: curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.15.
3 zlib/1.2.3 libidn/1.18 libssh2/1.4.2
> Host: localhost
> Accept: */*
> Content-Type: application/json
> Content-Length: 21
> 
< HTTP/1.1 201 Created
< Date: Wed, 23 Jul 2014 06:46:16 GMT
< Location: https://localhost/jenkins/queue/item/53/ 
<https://refgw3/jenkins/queue/item/53/>
< Content-Length: 0
< Connection: close
< Content-Type: text/plain; charset=UTF-8
< 
* Closing connection #0




Here is my code in PHP that used to work : 
// ... this is in a class, thus the member
    $this->ch = curl_init();
    curl_setopt($this->ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($this->ch, CURLOPT_SSL_VERIFYPEER, 0);
    curl_setopt($this->ch, CURLOPT_HEADER, 0);
    curl_setopt($this->ch, CURLOPT_USERPWD, $user . ":" . $password);
    curl_setopt($this->ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
    curl_setopt($this->ch, CURLOPT_URL,
         $this->baseUrl . "job/" . $jobName . "/buildWithParameters?module=" 
. $moduleName);
    curl_setopt($this->ch, CURLOPT_HTTPHEADER, array('Accept: 
application/json'));
    curl_setopt($this->ch, CURLOPT_POST, true);

    $result = curl_exec($this->ch);
// here $result has a header but no body

Thank you in advance for your help, 
Barth

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to