jenkins script console run curl command code example
Example 1: jenkinsfile run curl in a function
def response = sh(script: 'curl https://some-host/some-service/getApi?apikey=someKey', returnStdout: true)
Example 2: jenkinsfile run curl in a function
def response = sh 'curl https://some-host/some-service/getApi?apikey=someKey'