Rasa shell --enable-api doesn't allow http requests on rasa

rasa run --enable-api allows the http requests, but rasa shell --enable-api doesn’t.

Any solution?

Hi. You shoud define a token using rasa shell --enable-api -t <your token>. Then in all your request, you should include that token. You can use also use --jwt-secret as argument for jwt credentials. In this case, you need to add an Authorization header, with a Bearer type for each of your request to the API. Check this link to see how to run a server.

Hope this help.

Thx… I tried this: rasa shell --enable-api -t mytoken

And then tried to connect http://localhost:5005?token=mytoken

Still didn’t work.

Also, I tried it with run: rasa run --enable-api -t mytoken

And then tried to connect http://localhost:5005?token=badtokenparam

And it worked… so it doesn’t look like it’s paying attention to -t token?

hey @mmm3bbb, actually rasa shell loads your trained model and lets you talk to your assistant on the command line whereas rasa run starts an action server using the Rasa SDK.

@JiteshGaikwad Thanks. I was just going from the documentation which showed that --enable-api is a valid option for rasa shell.

Also, since it doesn’t seem to matter what the value is for the -t token option on rasa run, I’m wondering if I’m doing something fundamentally wrong or this is just still a work in progress.

@Tanja any idea what’s going on here?

I could not reproduce the problem. I set up a new project with the latest rasa version using rasa init. Afterwards, I started the rasa server with rasa run --enable-api -t mytoken and made a request

curl -X POST \
  'http://localhost:5005/model/parse?token=badtoken' \
  -H 'Content-Type: application/json' \
  -d '{
    "text": "Hello!"
}'

The request failed due to NotAuthenticated (401). Using the correct token mytoken gets me a valid response. @mmm3bbb What version of Rasa are you using? What steps did you execute?

OK, turns out the server information endpoints (e.g., /status) don’t use the token. It works as you posted above for other endpoints. Thx