Issue
I would like to be able to build a job remotely using the Jenkins REST API and cURL.
This also provides a workaround for JENKINS-12543, that doesn’t require SSH Key Authentication.
Environment
- CloudBees Jenkins Enterprise
- Remote Access API
- cURL
Resolution
Example build:
curl -X POST http://USER:API_TOKEN@localhost:8080/job/test/build
Obviously, replace:
USER:API_TOKEN
with your username and API tokenlocalhost:8080
with your Jenkins URLtest
with your job name
Example build with String parameter:
curl -X POST http://USER:API_TOKEN@localhost:8080/job/test/build --data-urlencode json='{"parameter": [{"name":"paramA", "value":"123"}]}'
Obviously, replace:
USER:API_TOKEN
with your username and API tokenlocalhost:8080
with your Jenkins URLtest
with your job nameparamA
with your parameter name123
with your parameter value
See Remote Access API for more.
8 Comments