Skip to content

Latest commit

 

History

History

rest-api

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

REST

Alias (including auth)

Ref: https://docs.cloudbees.com/docs/admin-resources/latest/cli-guide/config-alias

alias jenkins-rest='/path/to/jenkins-rest.sh'

Depth control

Control de mount of data with tree and depth

Ref: https://www.jenkins.io/doc/book/using/remote-access-api/#RemoteaccessAPI-Depthcontrol

Crumb

Call to REST API including the .crumb in the same call

curl --user $USER:$APITOKEN -H $(curl --user $USER:$APITOKEN [-H "CRUB"] $SERVER/crumbIssuer/api/xml?xpath=concat\(//crumbRequestField,%22:%22,//crumb\))  $SERVER/job/hello-world-flow/build?token=codebase&cause=push

Jobs

jenkins-rest --type -XGET --operation "api/json?pretty=true&depth=1"

RBAC

List groups

$ jenkins-rest --type -XGET --operation "groups/api/json?depth=1&tree=groups[name]"
{
_class: "nectar.plugins.rbac.groups.RootProxyGroupContainer",
groups: [
{
name: "administrators"
},
{
name: "users"
},
{
name: "viewers"
},
...
{
name: "fbelzunc-viewer"
}
]
}

Create groups

jenkins-rest --type -XPOST --operation "groups/createGroup/api/json?name=developers"

CasC

List bundles

jenkins-rest --type -XGET --operation "casc-bundle/list"

Regenerate token

jenkins-rest --type -XPOST --operation "casc-bundle/regenerate-token?bundleId=zd190212"

Availability pattern

jenkins-rest --type -XPOST --operation "casc-bundle/set-availability-pattern?bundleId=Apps-1p&regex=seco-1252"