Rasa nlu server failure - node.js

I started the rasa server by typing this command in cmd:
rasa run --enable-api -m models/(my_model).tar.gz --cors "*" --debug
I put this command in another cmd:
curl -X POST localhost:5005/model/parse -d '{"text":"hello"}'
After that I got this error:
{"version":"1.2.2","status":"failure","message":"An unexpected error occurred. Error: Failed when parsing body as json","reason":"ParsingError","details":{},"help":null,"code":500}
Any help? How can I integrate Rasa with Node.js?

Please try
curl -H "Content-Type: application/json" -X POST -d '{"sender":"y1mLd","message":"hi"}' http://localhost:5005/webhooks/rest/webhook
Output would be
[{"recipient_id":"y1mLd","text":"Welcome, Please let me know how I could be a help today!"}]
Hope this helps!

Simple curl without method type worked for me:
curl localhost:5005/model/parse -d '{"text":"hello"}'

I also faced this error on Windows 10 . Following commands worked for me finally.
curl localhost:5005/model/parse -d "{\"text\":\"hello\"}"
and
curl -H "Content-Type: application/json" -X POST localhost:5005/model/parse -d "{\"text\":\"hello\"}"

Related

windows command prompt curl POST to run Azure DevOps pipeline

I am trying to run an Azure DevOps pipeline from the windows command prompt using curl.
Based on Microsoft documentation ( Runs - Run Pipeline ) I should be able to run a pipeline by posting:
https://dev.azure.com/{organization}/{project}/_apis/pipelines/{pipelineId}/runs?api-version=6.0-preview.1
I am able to GET using the command:
curl -u :<PAT> https://dev.azure.com/{organization}/{project}/_apis/pipelines/{pipelineId}/runs?api-version=6.0-preview.1
However, I can't figure out how to do a POST for DevOps using curl to run the pipeline.
I have tried the following:
curl -s -X POST -L https://dev.azure.com/{organization}/{project}/_apis/pipelines/{pipelineId}/runs?api-version=6.0-preview.1 -H "Accept: application/json" -H "Content-Type: application/json" -H "Authorization: Basic <PAT>"
But this returns the error
HTTP Error 411. The request must be chunked or have a content length
I managed to solve my problem which consisted of numerous steps:
Log the API call from the DevOps website to get the correct format of the json-body ( See this question ).
Format the json-body with extra double quotation signs.
Use the {project}-id instead of the ascii-name since it included a special character which the command prompt misinterpret.
Hence the complete curl command was:
curl -X POST -u :<PAT> "https://dev.azure.com/{organization}/{project}/_apis/pipelines/{pipelineId}/runs?api-version=6.0-preview.1" -H "Content-Type: application/json" -d "{""stagesToSkip"": ""[]"", ""resources"": {""repositories"": {""self"": {""refName"": ""refs/heads/master""}}}}"

Run query API in curl

I'm trying to explore the curl connect or retrieve the data with query API link but when I run my GET command in curl it runs without any error shown in -vv but the process stop. below the actual statement at the end of the posted process, may I know if this is normal or I need to add an additional arguments or parameters on my command for me to retrieve the data? If yes may I know how to do it?
Connection #1 to host myserver.com left intact
My command
curl -vv -k -X GET -H --user user123:password1 -H "Accept: application/json" https://myapplink/statement/EXE=sample

azure -command not found while running GET command

curl -X GET -H "Authorization: Bearer<token>" -H "Content-Type: application/json" https://management.azure.com/subscriptions/xxxx-xxx-xxxxxx-xxxxxxxxx/providers/microsoft.insights/eventtypes/management/values?api-version=2015-04-01&$filter=eventTimestamp ge '2019-03-21T00:00:00Z' and eventTimestamp le '2019-03-24T20:40:00Z' and resourceGroupName eq 'name'&$select=operationName,status,level
This command is used for collection azure activity log I am running this command in the CLI its giving error
bash: =,status,level: command not found...
bash: =eventTimestamp: command not found...
Hi I found the solution myself
the POST request that you are using copy and paste to Postman(software). Then click on "code". https://management.azure.com/subscriptions/xxxx-xxxxx-xxxxx-xxx/providers/microsoft.insights/eventtypes/management/values?api-version=2015-04-01&$filter=eventTimestamp%20ge%20%272019-03-21T00:00:00Z%27%20and%20eventTimestamp%20le%20%272019-03-24T20:40:00Z%27%20and%20resourceGroupName%20eq%20%27Ajay%27&$select=operationName,status,level'

curl command in linux

How we can add JSON parameters in a curl command to fetch data ?
PS: I have tried to fetch data from some source using curl command but it requires passing JSON parameters in it. So how I will accomplish it ?
I think mentioning content type as json and passing data will do the things right
curl -H "Content-Type: application/json" -d '{"key1":"value1","key2":"value2"}' http://domain.com/rest/path/here
Above will work for GET Method, for POST method
curl -H "Content-Type: application/json" -X POST -d '{"key1":"value1","key2":"value2"}' http://domain.com/rest/path/here

can't create server-admin in couchdb

I'm following the couchdb security documentation (http://docs.couchdb.org/en/1.6.1/intro/security.html) to try to create a server-admin using cURL: curl -X PUT $HOST/_config/admins/anna -d '"secret"'
When I do this, I get an error:
{"error":"not_found","reason":"Database does not exist."}
I'm on v2.0 so I don't known if something has changed since the 1.6 version of the documentation. I can create server-admins just fine using fauxton. Any ideas?
To anybody else running into this issue, it's an easy answer: in couchdb 2.0 some of the APIs moved to using port 5986 ... I had been using port 5984 (which is still used a lot in v2.0, but apparently not for the _config endpoint).
The following works:
curl -X PUT http://localhost:5986/_config/admins/admin1 -d '"password"'
The Couchdb2 way of adding a user is
curl -X PUT http://localhost:5984/_node/nodename/_config/admins/admin1 -d '"password"'
In the GUI, you can find out that you need to set up a single node cluster, and when you do that you specify the admin username and password.
And you can do the same thing using an API endpoint that you can POST to:
http://docs.couchdb.org/en/2.1.0/api/server/common.html#post--_cluster_setup
With 2.0 using enable_single_node returned {"error":"bad_request","reason":"Invalid Action'"} so I reverted to doing:
j=$(cat <<EOF
{
"action": "enable_cluster",
"bind_address": "0.0.0.0",
"username": "admin",
"password": "$PASS",
"port": "5984",
"node_count":"1"
}
EOF
)
curl -s -X POST -H "Content-Type: application/json" http://$IP/_cluster_setup -d "$j"
curl -s -X POST -H "Content-Type: application/json" $URI/_cluster_setup -d '{"action": "finish_cluster"}'

Resources