title: How to retrieve the HTTP code from groovy curl execute method
body: <p>I am using groovy execute API in Jenkins pipeline code to execute the curl command, I am getting response from the rest API, but I am not able to retrieve HTTP code.</p>
  <p>How to retrieve the HTTP code from groovy curl execute method.</p>
  <pre><code>node{
      stage(&quot;api&quot;)
      {
          getApi()
       }
  
  
  }
  def getApi()
  {
       def process  = ['bash', '-c',&quot;curl -X GET --header 'Content-Type: application/json' --header 'Accept: application/json' -H 'Authorization: Bearer oosfjwejowjefojwoejfowoefjwojefwefweofjwo' https://myrest.api.com&quot;].execute()
       process.waitFor()
       println (process.err.text)
       println (process.text)
  }
  </code></pre>