Home > Mobile >  How to call REST API to external server from Jenkins
How to call REST API to external server from Jenkins

Time:07-06

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.

enter image description here

How to call external server REST API in Jenkins? is it impossible?

CodePudding user response:

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"
  • Related