Forum Discussion
10 Replies
- tlikarishEmployee
Have you taken a look at the Rest Snap Pack?
- RudradipNew Contributor II
I am also facing the same issue . Is there any way out to call the curl command from the REST snaps ? I checked the documentation but could not find anything regarding that .
- robinFormer Employee
Can you provide an example of the type of curl command(s) you wish to run?
- smudassirEmployee
If you want to execute CURL command, you can use Script snap. You have choice to choose between JavaScript/Python/Ruby. Using Python, you can invoke CURL command via SubProcess module. subprocess — Subprocess management — Python 3.10.6 documentation
- RudradipNew 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”]’ " - smudassirEmployee
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_RayavaraNew Contributor III
I have used Rest post snap and it is working for me
- anivtkNew Contributor II
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’
- Sowmya_RayavaraNew Contributor III
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
If you use username & password as authentication then use rest basic auth account for authorization
- acesarioContributor II
Does this mean that your document$ ‘$’ is the curl?
What if I want to use this?
curl -f -u “demo:ce544b6ea52a5621fb9d55f8b542d14d” \ -o result.pdf \ -F “url=http://en.wikipedia.org” \ https://api.pdfcrowd.com/convert/20.10/