cancel
Showing results for 
Search instead for 
Did you mean: 

How to execute curl command using snaps

Sowmya_Rayavara
New Contributor III

Hi,

Is there any Snaps available to execute the ‘cURL’ commands in Snaplogic? if Yes, Can you please let us know the process.

Thanks in Advance.

10 REPLIES 10

Rudradip
New Contributor II

This type of sample curl comand : "curl -v http://localhost:8093/query/service
-d ‘statement=SELECT text FROM tweets WHERE rating = $1 AND when > $2&args=[ 9.5, “1-1-2014”]’ "

smudassir
Employee
Employee

First of all, I hope your service http://localhost:8093/query/service is located within the plex/node where you are executing the pipeline. If not, then its an incorrect use-case. If yes, then there are two ways to do it.

(a) Use REST POST snap. The entire body can be given in Entity property.
(b) Use Script snap with python/javascript and invoke the post call using the respective library.

But, first option is the best and the easiest.

Sowmya_Rayavara
New Contributor III

I have used Rest post snap and it is working for me

Sowmya,

I saw your post for running curl command and saw that you ran it successfully using REST POST. can you please share details how to run the curl command using REST POST.

Note: I need to run the curl command like

curl -v -u abc@pqr.com -H ‘Content-Type:application/json’ --data-binary ‘{“unlock”:true}’ ‘https://elastic.snaplogic.com/api/1/rest/asset/user/xyz@pqr.com

Hi Anil,

Provide the URL “https://elastic.snaplogic.com/api/1/rest/asset/user/xyz@pqr.com” in service URL and mention content type as application/json
image
image
If you use username & password as authentication then use rest basic auth account for authorization