Thursday, October 11, 2018

Useful jenkins urls


API token
c2ed2dc5e57d6f8bb4be378cbc0abf73

Get the job queue
http://9.42.40.122:8080/queue/api/json?pretty=true

Get the crumb:
crumbvar=$(curl -u tongli:c2ed2dc5e57d6f8bb4be378cbc0abf73 http://9.42.40.122:8080/crumbIssuer/api/json)

Show the crumb:
echo $crumbvar

Trigger a build:
curl -vvv -H "Jenkins-Crumb:afa4c106b6a34ff9a8caa1ae9ce3f4d2" -X POST \
http://tongli:c2ed2dc5e57d6f8bb4be378cbc0abf73@9.42.40.122:8080/job/testBuild/buildWithParameters?jobCommand=start


The response header:
< HTTP/1.1 201 Created
< Date: Mon, 09 Apr 2018 14:02:29 GMT
< X-Content-Type-Options: nosniff
< Location: http://9.42.40.122:8080/queue/item/216/
< Content-Length: 0
< Server: Jetty(9.4.z-SNAPSHOT)
<
* Connection #0 to host 9.42.40.122 left intact


Get all the builds of a job:
http://9.42.40.122:8080/job/testBuild/api/json?pretty=true

Get build specific info for build testBuild  #17
http://9.42.40.122:8080/job/testBuild/17/api/json?pretty=true

Get only desired info for a job build
http://9.42.40.122:8080/job/testBuild/17/api/json?pretty=true&tree=result,id,queueId,url
http://9.42.40.122:8080/job/testBuild/17/api/xml?pretty=true&tree=result,id,queueId,url


Get the build number by using queue id:
This call queries job named testBuild with queue id of 218
http://9.42.40.122:8080/job/testBuild/api/xml?tree=builds[id,number,result,queueId]&xpath=//build[queueId=218]

http://9.42.40.122:8080/job/testBuild/api/json?tree=builds[id,number,result,queueId]


The pattern is tree=keyname[field1,field2,subkeyname[subfield1]] and so on.


@litong01 "username":"bmxbcv1@us.ibm.com",
"password":"m072017j",
"org":"bcstarterplantest1@gmail.com",
"space":"dev",
"apiendpoint":"https://api.stage1.ng.bluemix.net",
"serviceInstanceName": "tmp-instance",
"service":"ibm-blockchain-5-staging",
"servicePlan":"ibm-blockchain-plan-v1-starter-staging",

No comments:

Post a Comment