How to update job config files using the REST API and cURL

Issue

I would like to be able to update job config files remotely using the Jenkins REST API and cURL.
 

Environment

  • CloudBees Jenkins Enterprise
  • Remote Access API
  • cURL

Resolution

Here is an example that I used to test this locally:

# Get current config
curl -X GET http://developer:developer@localhost:8080/job/test/config.xml -o mylocalconfig.xml

# Post updated config
curl -X POST http://developer:developer@localhost:8080/job/test/config.xml --data-binary "@mymodifiedlocalconfig.xml"

Obviously, replace:

  • developer:developer with your username:password
  • localhost:8080 with your Jenkins URL
  • test with your job name

See Remote Access API for more.

Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.