I wonder how to call REST API from a (groovy) Jenkins workflow script. I can execute "sh 'curl -X POST …'" – it works, but building the request as a curl command is cumbersome and processing the response gets complicated. I'd prefer a native Groovy HTTP Client to program in groovy – which one should I start with? As the script is run in Jenkins, there is the step of copying all needed dependency jars to the groovy installation on Jenkins, so something light-weight would be appreciated.
How to call REST from jenkins workflow
groovyjenkins-workflow
Best Answer
Native Groovy Code without importing any packages: