Skip to content

Instantly share code, notes, and snippets.

@tuxfight3r
Created June 9, 2015 11:15
Show Gist options
  • Save tuxfight3r/58bd9b69134791c64255 to your computer and use it in GitHub Desktop.
Save tuxfight3r/58bd9b69134791c64255 to your computer and use it in GitHub Desktop.
Jenkins REST API Automation via curl
#Get the current configuration and save it locally
curl -X GET http://user:[email protected]/job/myjobname/config.xml -o mylocalconfig.xml
#Update the configuration via posting a local configuration file
curl -X POST http://user:[email protected]/job/myjobname/config.xml --data-binary "@mymodifiedlocalconfig.xml"
#Creating a new job via posting a local configuration file
curl -X POST "http://user:[email protected]/createItem?name=newjobname" --data-binary "@newconfig.xml" -H "Content-Type: text/xml"
Note: Use --data-binary to post the data, else the line-endings won’t be transfered correctly
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment