Nirbhay Singh
Nirbhay Singh

Reputation: 51

How to use CURL command in groovy script

I am using below curl command:

curl -u "nnarayan1" https://ipsddress:port/api/v3/orgs/RB-Health-rbESB/repos --insecure

How can I get output of above curl command using groovy scripting?

Kindly suggest groovy script for this.

I tried different solution from stackoverflow, none of them is working.

Upvotes: 1

Views: 17715

Answers (2)

Pankaj Saini
Pankaj Saini

Reputation: 1648

def response
response = sh(
    script: 'curl --insecure -u nnarayan1 https://ipsddress:port/api/v3/orgs/RB-Health-rbESB/repos',
    returnStdout: true
)

I would personally avoid specifying the "--insecure" flag.

Upvotes: 1

gXg
gXg

Reputation: 528

def res = sh(script: 'curl --insecure -u nnarayan1 https://ipaddress:port/api/v3/orgs/RB-Health-rbESB/repos', returnStdout: true)

Upvotes: 1

Related Questions