Rasa REST API implementation

Hello Everyone,

I m able to use HTTP API while running Rasa X locally? I m using documentation available here: Link

But when I tested this, with my cloud instance i m not getting response in json format.

What i m doing wrong?

Screenshots of postman running locally:

even responding with api

now when i m trying same from cloud its not working, i m using docker to host the rasa x

im getting this html response:

and in json response :

.

Am i querying something wrong.

I m new to rest api implementation. Please help

1 Like

@Rasa @JiteshGaikwad @Juste

Can someone help here

Can you try with the port number? Also, check if the port is enabled on the server for TCP traffic?

@KarthiAru thanks for your reply. Which port should i check and where & how should i put ports in it. Can you be elobrate?

Something like this <url>:<port>/webhooks/rest/webhook

You can check How To Set Up a Firewall with UFW on Ubuntu 18.04 | DigitalOcean for allowing TCP traffic.

check it for port 5005 Try this

http://34.69.54.64:5005/webhooks/rest/webhook

I have reached some solution using HTTP API

But issue is i want to fetch data. But ut is only responding by 200 ok status. I want json data of message reply. Any help will be appreciated. Thanks

1 Like

@athenasaurav what have you received after testing send a screenshot

Hello @wabi thanks again for responding, This is response in postman. Status is ok but it is not returning the logs i have tried all get and post requests, i only get 200 OK Status but i dont get JSON respose to messages. Even after using port address exposed. I even queried it in Juypter notebooks the respose received is 200, OK status.

1 Like

Hi @athenasaurav !

I’m really new to this api calls concept ;(

I was wandering if you could give me a quick step by step guide on how you linked your rasabot to Postman ?

I tried getting help from these links:

https://rasa.com/docs/rasa/1.9.1/api/http-api/#tag/Domain

But unfortunately the server can’t upload my model. I don’t know if i’m making some mistakes in my endpoints.yml file :S .

Can we do some API calls using Rasa Core instead of Rasa X ?

Thanks in advance for your return !

Bob

Hey, you want to configure for localhost or on Gcloud. on local host its very simple you have to open two command prompts and in 1 you have to run ‘’‘rasa run actions’’’ in 2 you have to run ‘’‘rasa run -m models --enable-api --cors “*” --debug’’’

then you have to point postman to with POST and get request.
‘’’ http://localhost:port/webhooks/rest/webhook ‘’’ You will get all POST and get request in terminal windows 2 or here[HTTP API].

I have issues with rasa x http api [HTTP API] to fetch models and conversation and uploading models using http api on Gcloud.

Thank you for the answer !

I managed to link it to my Rasa Core :slight_smile:

How do you simulate now a conversation with the bot using Postman ?

Just give it a post reply with body as raw json in following format:

{ “Message”: “hi”, “Sender”: “rasa” }

2 Likes

Hello, I am facing exactly the same issue but locally, it returns an html response instead of json, the status is OK 200; I’m running the project in a virtual environment on ubuntu. any help? @athenasaurav

Hello @RedaElmar,

Please share screenshot of what is happening

thank you @athenasaurav , here is the screens

this is the response i get 200 OK for the request but it gives me an error when i try to retreive Json. instead it gives me this html (same as you) the code i use

Hey @RedaElmar, Have you tried sending message in postman with json format?

your code should be like this :

import requests

url = "http://localhost:<PORT>/webhooks/rest/webhook"

payload = "{\r\n    \"message\": \"Your message\"\r\n}"

response = requests.request("POST", url, headers=headers, data = payload)

print(response.text.encode('utf8'))