I'm trying to pass slash option on CLI via POST request like:
curl -i -H "Accept: application/json" -H "Content-Type:application/json" -X POST --data "{"content": "/command test"}" webhook_url
But "/" character acting like a character in the Discord channel instead of command prompt. Is there any possibility to do that or it's just possible for your own bot? Just I want to pass any command for a specific bot (not mine) on the CLI.
It should be prompt as in the Discord on browser or client instead of text.
I have the following batch file that is executing cURL POST command:
curl -i -X POST -H "Content-Type: application/json" -d "{\"text\": \"Hello:\"}" https://xxx
exit
Then I exec the code with windows command, It's work. But if I tried with the same code on a bat file, It didn't work at all.
I thing it could be the "\" ?
Tks for your help.
I am trying to run a POST call to update dialog node of watson assitant but getting error {"error":"Invalid CSRF Token"}.
my curl command is:
curl -H "Content-Type: application/json" -X POST -u "03abc-6def3-4sds53-9red-394aaaaaaaaaaaae2:passwprd" -d "{\"dialog_node\":\"handler_40_133229823644\",\"type\":\"event_handler\",\"conditions\":\"$version == null\",\"parent\":\"slot_39_1521312319823644\",\"previous_sibling\":\"handler_41_1543623423444\",\"output\":{},\"context\":{\"temp\":\"$version == null\",\"sys_options\":[{\"label\":\"19.5.0\",\"value\":\"1950\"},{\"label\":\"19.2.1\",\"value\":\"1921\"},{\"label\":\"19.2.0\",\"value\":\"1920\"},{\"label\":\"18.11.1\",\"value\":\"1812\"},{\"label\":\"18.11.0\",\"value\":\"1811\"},{\"label\":\"18.8.1\",\"value\":\"1881\"},{\"label\":\"18.8.0\",\"value\":\"1880\"},{\"label\":\"18.5.1\",\"value\":\"1851\"},{\"label\":\"17.5.0\",\"value\":\"1851\"}]},\"actions\":null,\"metadata\":{},\"event_name\":\"input\"}" "https://assistant-us-south.watsonplatform.net/rest/v1/workspaces/adjs42424-73423de-324dd-d397-affasdsade234ad27/dialog_nodes/handler_40_154asdasd823644"
I think you are missing the version in the url. From the API documentation - https://cloud.ibm.com/apidocs/assistant#update-dialog-node it should be something like -
curl -u "apikey:{apikey}" -H "Content-Type: application/json" -X POST -d "{\"output\":{\"generic\":[{\"response_type\":\"text\",\"values\":[{\"text\":\"Hello! What can I do for you?\"}]}]}}" "https://gateway.watsonplatform.net/assistant/api/v1/workspaces/{workspace_id}/dialog_nodes/greeting?version=2019-02-28"
The example doesn't include the dialog node as part of the -d json structure, and makes use of an IAM Key instead of userid / password authentication. Though if your service credentials still are userid / password based they should still work.
Is there anyway to use the curl command to update the solr with all the files under a directory? For example like update all the XML files:
curl "http://localhost:8983/solr/xml/update?commit=true&tr=add.xsl" -H "Content-Type: text/xml" --data-binary #*.xml
Using the post.jar, I was able to run these updates, but I am not looking the same function on using CURL ?
Thanks in advance.
I don't think CURL supports making wildcard posts through --data-binary. It does support some globbing in its -T parameter, but that issues a PUT (as it uses the baseurl + filename). You'll also have to expand the list yourself, as I couldn't get * to work as globbing pattern.
The easiest way is probably to wrap it in a for-loop instead, which will depend on how you're running curl (and what OS or shell you're using).
#!/usr/bin/env bash
for FILE in *.xml
do
curl "http://localhost:8983/solr/xml/update?commit=true&tr=add.xsl" -H "Content-Type: text/xml" --data-binary #$FILE
done
Hi guys i'am new working with curl, I've already played with wget but never with curl.
My problem is i want to download a csv from a url with GET params but when i do the request curl goes to infinite loop and doesn't do anything and doesn't give any error.
curl --verbose -X 136.17.0.23:83 -U myProxyUser:myProxyPassword -u myHttpUser:myHttpPassword -o C:\outfile "http://136.16.120.13/webtrac/universal_ajax.aspx?tableIdx=54&mode=export&filters=%%22groupOp%%22:%%22AND%%22,%%22rules%%22:\\[{%%22fnield%%22:%%22Year%%22,%%22op%%22:%%22bw%%22,%%22data%%22:%%222014%%22}\\]}&selection="