Multiple slots setting via http api

juste
(Barun) #1

I am new in RASA and need your help. I can understand there is an api for setting slot i.e “conversations/default/{sender_id}/events” and the payload is like { “event”: “slot”, “name”: “gender”, “value”: “male” } Is there any api available to set multiple slots value at one transaction. I need something like below.

[{ “event”: “slot”, “name”: “gender”, “value”: “male” }, { “event”: “slot”, “name”: “age”, “value”: 21 }, { “event”: “slot”, “name”: “name”, “value”: “Peter” } ]

(Juste) #2

Hey @bdbarun. Do you get an error when you pass slots in a list like that?

(Barun) #3

Hey @Juste , thanks for your response. I am getting internal server error from my rest client while trying to call conversations/{sender_id}/tracker/events with the above mentioned payload. The debug log shows the below error.

2019-03-25 10:41:01 ERROR flask.app - Exception on /conversations/Developer/tracker/events [POST] Traceback (most recent call last): File “C:\ProgramData\Anaconda3\envs\rasachat_env\lib\site-packages\flask\app.py”, line 2292, in wsgi_app response = self.full_dispatch_request() File “C:\ProgramData\Anaconda3\envs\rasachat_env\lib\site-packages\flask\app.py”, line 1815, in full_dispatch_request rv = self.handle_user_exception(e) File “C:\ProgramData\Anaconda3\envs\rasachat_env\lib\site-packages\flask_cors\extension.py”, line 161, in wrapped_function return cors_after_request(app.make_response(f(*args, **kwargs))) File “C:\ProgramData\Anaconda3\envs\rasachat_env\lib\site-packages\flask\app.py”, line 1718, in handle_user_exception reraise(exc_type, exc_value, tb) File “C:\ProgramData\Anaconda3\envs\rasachat_env\lib\site-packages\flask_compat.py”, line 35, in reraise raise value File “C:\ProgramData\Anaconda3\envs\rasachat_env\lib\site-packages\flask\app.py”, line 1813, in full_dispatch_request rv = self.dispatch_request() File “C:\ProgramData\Anaconda3\envs\rasachat_env\lib\site-packages\flask\app.py”, line 1799, in dispatch_request return self.view_functionsrule.endpoint File “C:\ProgramData\Anaconda3\envs\rasachat_env\lib\site-packages\flask_cors\decorator.py”, line 128, in wrapped_function resp = make_response(f(*args, **kwargs)) File “C:\ProgramData\Anaconda3\envs\rasachat_env\lib\site-packages\rasa_core\server.py”, line 115, in decorated return f(*args, **kwargs) File “C:\ProgramData\Anaconda3\envs\rasachat_env\lib\site-packages\rasa_core\server.py”, line 44, in decorated return f(*args, **kwargs) File “C:\ProgramData\Anaconda3\envs\rasachat_env\lib\site-packages\rasa_core\server.py”, line 251, in append_event evt = Event.from_parameters(request_params) File “C:\ProgramData\Anaconda3\envs\rasachat_env\lib\site-packages\rasa_core\events_init_.py”, line 107, in from_parameters event_name = parameters.get(“event”) AttributeError: ‘list’ object has no attribute ‘get’

(Kaveri) #4

Change the request method from ‘POST’ to ‘PUT’ for the URI ‘/conversations/{sender_id}/tracker/events’.