The /%1$s/
endpoint
Security
When your Jenkins is secured, you can use HTTP BASIC authentication to authenticate remote API requests. See Authenticating scripted clients for more details.
Cross Site Request Forgery (CSRF) protection
If your Jenkins uses the "Prevent Cross Site Request Forgery exploits" security option (which it should), when you make a POST request, you have to send a CSRF protection token as an HTTP request header. See CSRF Protection for more details.
WARNING
This endpoint SHOULD be reachable only through a secure channel.
Build commands
The following build commands are available to POST to:
Name |
Path |
Sample payload |
%2$s
Example
Suppose we have a secured Jenkins server at %3$s
, a dedicated Remote Trigger user named remote
that has an API Token of 92e9d8998a8c005697d252f09a2a311b
and the following payload.json
file:
{
"parameter":
[
{"name":"id","value":"123"},
{"name":"verbosity","value":"high"}
]
}
The following example demonstrates a GET to the /crumbIssuer
endpoint to retrieve a header and then a POST to the ping
command for the job named JOB_NAME using the curl tool:
crumb=$(curl '%3$scrumbIssuer/api/xml?xpath=concat(//crumbRequestField,":",//crumb)' --user remote:92e9d8998a8c005697d252f09a2a311b)
curl --request POST %3$s%1$s/ping/JOB_NAME --data-urlencode json@payload.json --user remote:92e9d8998a8c005697d252f09a2a311b --header "$crumb"
The console output should look like the following when the ping
command from the %1$s
endpoint returns the provided payload, formatted for compactness:
{"parameter":[{"name":"id","value":"123"},{"name":"verbosity","value":"high"}]}