Need Help in executing Rest API in Jenkins Job

14 views
Skip to first unread message

phanindra m

unread,
Jan 13, 2020, 11:43:38 PM1/13/20
to Jenkins Users
Hi,

I'm Trying to Run Rest API in Jenkins Job, but facing few issues. 

below command will fetch the session id of an application and stores it in a var variable. this command is working fine in GIT Bash, but when i trying to run this command in Execute Shell option in jenkins it is not working.  So can any one help me on this.

var=$(curl --silent 'http://URL/Login?sUserId=UserID&sPassword=password' | sed -nr 's/.*>(.*)<.*/\1/p')
echo $var

Thanks In Advance,

Phani

Björn Pedersen

unread,
Jan 14, 2020, 2:19:49 AM1/14/20
to Jenkins Users
Hi,

from your GIT Bash mention I assume that you are  running on Windows.
Are you sure jenkins is using your git bash as shell, and not either another bash or powershell?

Or is it even running on a different host, where  may some programms (curl/sed) are not available?
Try running just curl to see the output before trying to catch the result.


Björn

ramesh pasham

unread,
Jan 14, 2020, 3:13:54 AM1/14/20
to jenkins...@googlegroups.com
Hi Phani,
Could you please provide the error log if you can?

thanks,
Ramesh

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/a1358aa9-d81f-44e4-a75c-b6fdf479c3f0%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages