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

(Michael Bell) #1

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

Any solution?

(Roger NENGWE) #2

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.

(Michael Bell) #3

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?

(JG) #4

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.

(Michael Bell) #5

@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.

(Ella Rohm-Ensing) #6

@Tanja any idea what’s going on here?

(Tanja Bergmann) #7

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?

(Michael Bell) #8

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