Issue
I want to implement that when a build is performed in Jenkins, call my server Rest API.
Calling Jenkins REST API on my server to perform Build was successful.
How to call external server REST API in Jenkins? is it impossible?
Solution
There are multiple ways to do this. One option is, you can use something like the HTTP Request Plugin. Then in your Post step, you can do the HTTP request like below.
def response = httpRequest 'https://your_host/something'
Another option is to simply use something like curl
to send an HTTP request. You can execute your curl
command within a sh
block.
sh "curl -vk https://your_host/something"
Answered By - ycr
Answer Checked By - Candace Johnson (JavaFixing Volunteer)