Error 400 when parse a message using the Rasa model

Hello everyone,

I’m currently testing my chatbot locally by running the server (running

rasa run -m models --enable-api --log-file out.log

I tried to send post requests using requests package of python, according to Rasa Docs with text as query parameter:

r = requests.post(url="http://localhost:5005/model/parse",params = {"text":"Order a pizza"})

Though, I receive a 400 Code Error

{'version': '1.0.9', 'status': 'failure', 'message': 'No text message defined in request_body. Add text message to request body in order to obtain the intent and extracted entities.', 'reason': 'BadRequest', 'details': {}, 'help': None, 'code': 400}

(The rasa core log file out.log is empty.)

Any help would be much appreciated, as I really don’t get where the problem comes from.

My config:

Ubuntu 18.04
Python 3.6
Rasa version : 1.0.9

HI @EvanD

I think you have to use the API the following way with requests:

payload = {"text": "Order a pizza"}

headers = {
    'Content-Type': "application/json",
    }

response = requests.request("POST", "http://localhost:5005/model/parse", data=json.dumps(payload), headers=headers)

The output lies in response.text then, which could be JSON.loads - parsed.

Tell, if you need more help.

4 Likes

It works, Thanks a lot !