Rasa nlu server problem with the error 500 and parsing - rasa-nlu

I started the nlu server by typing this command in cmd:
rasa run --enable-api -m models/(name of my package).tar
and then in other cmd window typed:
curl localhost:5005/model/parse -d ‘{“text”:“hello”}’
after that I got an error:
{“version”:“1.2.3”,“status”:“failure”,“message”:“An unexpected error
occurred. Error: Failed when parsing body as
json”,“reason”:“ParsingError”,“details”:{},“help”:null,“code”:500}
What is the reason for it? what should I change to get the normal(200) output?

can you please try this and see whether it works.
rasa run -m models --enable-api --cors ‘*’ --debug

CURL POST Request (Mac and Ubuntu):
curl -H "Content-Type: application/json" -X POST -d '{"sender":"y1mLd","message":"hi"}' http://localhost:5005/webhooks/rest/webhook
Note : for windows you need to remove the quotes
curl -H "Content-Type: application/json" -X POST -d {"sender":"y1mLd","message":"hi"} http://localhost:5005/webhooks/rest/webhook
Output
[{"recipient_id":"y1mLd","text":"Welcome, Please let me know how I could be a help today!"}]

Related

Jira API GET all users from Jira project with specific status

In my Ruby app I'm trying to get all agent users from my service desk board. It means all users with status: 'ServiceDesk'. Is it possible using only base auth?
In curl I was trying something like:
curl -D -u USERNAME:PASSWORD -X GET -H "Content-Type: application/json" https://company_name.atlassian.net/rest/api/2/user/assignable/search?project=SERVICEDESK
But all what I get is an error:
Warning: The file name argument '-u' looks like a flag.
curl: (3) URL using bad/illegal format or missing URL
{"errorMessages":["Internal server error"],"errors":{}}%
Is there any way to get those data with basic auth?
I think there's an issue with the curl command, try this
curl -D- -u USERNAME:PASSWORD https://company_name.atlassian.net/rest/api/2/user/assignable/search?project=SERVICEDESK

jenkins pipeline. curl get works but post doesn't

I'm running Jenkins pipeline job on a windows 10 agent.
i'm trying to publish some information from the agent to confluence.
Running with script.bat:
curl --fail --silent --show-error -u ****:**** -X GET <SomeInternalAddress>
works!
but running:
curl --fail --silent --show-error -u ****:**** -X POST -H 'Content-Type: application/json' -d '#tmpCurlPostData.txt' <SomeInternalAddress>
results with:
curl: (6) Could not resolve host: application
curl: (22) The requested URL returned error: 415
tried escape a '=' in the password with '^'. tried surrounding with quotes.
but with no success.
interesting fact, the same code works fine on win 7,
testing it on a new win 10 machine revealed the problem.
would appreciate any idea guys.
thanks a lot!

curl in windows read function returned funny value

I am using the following command to upload file to an endpoint
curl -X POST -H "authorization: Basic base64encode" -H "Content-Type:
multipart/form-data" -H "X-Atlassian-Token: nocheck" -F
"file=#c:/Users/User/Desktop/testresults.xml" https://jira.test-
server.ag/rest/api/latest/issue/man-287/attachments
the command under mac works without problems, under windows I become the following error
curl: (26) read function returned funny value
curl version
curl 7.64.0 (x86_64-w64-mingw32) libcurl/7.64.0 OpenSSL/1.1.1a
installed using https://chocolatey.org
I ran into the same problem when I used curl on the Windows Subsystem for Linux on Windows 10. I had to change the path from C:\Temp\File.txt to /mnt/c/Temp/File.txt.
Check if you can access the file in your shell e.g. with dir c:\path\to\file.txt and if it fails then you know that you have to fix the path first.

How to get H2O automl working from command line using CURL?

I am trying to launch H2O AutoML from command line with CURL and could not get it working..
The base command is something as below:
curl -X POST -H 'application/x-www-form-urlencoded; charset=UTF-8' -d 'training_frame=12cfbae9-af66-42fd-835f-13ccc5a508ab' "http://localhost:54321/99/AutoMLBuilder"
I tried with various parameters with but I always get error as unknown parameter.
I had the use the CURL command as below to make it work:
curl -X POST -H 'Content-Type: application/json' -d '{"input_spec":{"training_frame":"1acfbae9-af66-42fd-835f-13ccc5a508cb","response_column":"mpg","ignored_columns":[],"sort_metric":null},"build_models":{"exclude_algos":[]},"build_control":{"nfolds":5,"keep_cross_validation_predictions":true,"keep_cross_validation_models":true,"balance_classes":false,"class_sampling_factors":[],"max_after_balance_size":5,"stopping_criteria":{"seed":-1,"max_models":0,"max_runtime_secs":30,"stopping_rounds":3,"stopping_tolerance":-1},"project_name":"automl-mpg"}}' http://localhost:54321/99/AutoMLBuilder
Above 1acfbae9-af66-42fd-835f-13ccc5a508cb is the training frame id.

Escaping curl command in Windows

I'm trying to run a curl command from the command line in Windows, but for the life of me I can't figure out how I'm supposed to escape it.
I'm executing this:
C:\WINDOWS\system32>curl --anyauth --user user:password -X POST -d "{\"rest-api\":{\"name\":\"BizSimDebug3\"}}" -H "Content-type: application/xml" http://localhost:8002/v1/rest-apis
And I'm getting this:
<rapi:error xmlns:rapi="http://marklogic.com/rest-api">
<rapi:status-code>400</rapi:status-code>
<rapi:status>Bad Request</rapi:status>
<rapi:message-code>RESTAPI-INVALIDCONTENT</rapi:message-code>
<rapi:message>Your bootstrap payload caused the server to throw an error. Underlying error message: XDMP-DOCROOTTEXT: xdmp:get-request-body() -- Invalid root text "{&quot;rest-api&quot;:{&quot;name&quot;:&quot;BizSimDebug3&quot;}}" at line 1</rapi:message>
</rapi:error>
Is there something else I need to do to escape the inner quotes in the -d flag? Or am I overlooking the real issue entirely?
This works in Windows:
curl -i -X POST -H "Content-Type: application/json" -d "{\"Field1\": 123, \"Field2\": 456 }" "http://localhost:8080"
The XDMP-DOCROOTTEXT error indicates the server is trying to parse the payload as XML and failing.
The Content-Type header is telling the server that you're sending XML, but the payload is JSON.
Try changing the Content-Type header to application/json
Quoting is hell. By "Windows Command Line and your prompt I presume you mean cmd.com ?. That doest quote the same as linux shells.
For this simplistic experiment I recommend going for 2 kinds of quotes to avoid escaping But even then its unlikely to work
curl --anyauth --user user:password -X POST -d "{'rest-api':{'name':'BizSimDebug3'}}" -H "Content-type: application/xml" http://localhost:8002/v1/rest-apis
Better luck might be had by going with a unix-like shell such as running cygwin (http://www.cygwin.com/) or maybe xmlsh (www.xmlsh.org) which escape like linux does.
You really are going to have a nightmare running anything complex through the windows command line natively.
-David

Resources