# Rasa REST API implementation

**URL:** <https://forum.rasa.com/t/rasa-rest-api-implementation/25992>\
**Category:** Rasa Open Source\
**Created:** [March 12, 2020, 12:35pm UTC](https://forum.rasa.com/t/rasa-rest-api-implementation/25992 "2020-03-12T12:35:13Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![athenasaurav](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/athenasaurav/32/8139_2.png) [@athenasaurav](https://forum.rasa.com/u/athenasaurav)\
**Post date:** [March 12, 2020, 12:35pm UTC](https://forum.rasa.com/t/rasa-rest-api-implementation/25992/1 "2020-03-12T12:35:14Z")

</div>

Hello Everyone,

I m able to use HTTP API while running Rasa X locally? I m using documentation available here: [Link](http://rasa.com/docs/rasa-x/api/rasa-x-http-api/?_ga=2.263275660.1847029640.1583908708-2061202528.1583908708)

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:

 ![image](https://europe1.discourse-cdn.com/flex013/uploads/rasa/original/2X/5/53cc0769e7f76212facef0d511455469f10120d6.png)

even responding with api

 ![image](https://europe1.discourse-cdn.com/flex013/uploads/rasa/original/2X/5/5c9c1c0525cfbc0101476f5c265c67e757f3ccf3.png)

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:

 ![image](https://europe1.discourse-cdn.com/flex013/uploads/rasa/original/2X/4/4f140d67400868ea416b068e99bdf628aaf89a71.png)

and in json response :

 ![image](https://europe1.discourse-cdn.com/flex013/uploads/rasa/original/2X/e/e5bcbec66419a4285be0100226d1ccb12be3b861.png) .

Am i querying something wrong.

I m new to rest api implementation. Please help

---

<div class="post-metadata">

**Author:** ![athenasaurav](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/athenasaurav/32/8139_2.png) [@athenasaurav](https://forum.rasa.com/u/athenasaurav)\
**Post date:** [March 12, 2020, 3:14pm UTC](https://forum.rasa.com/t/rasa-rest-api-implementation/25992/2 "2020-03-12T15:14:21Z")

</div>

@Rasa @JiteshGaikwad @Juste

Can someone help here

---

<div class="post-metadata">

**Author:** ![KarthiAru](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/karthiaru/32/7163_2.png) [@KarthiAru](https://forum.rasa.com/u/KarthiAru)\
**Post date:** [March 13, 2020, 3:48am UTC](https://forum.rasa.com/t/rasa-rest-api-implementation/25992/3 "2020-03-13T03:48:34Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![athenasaurav](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/athenasaurav/32/8139_2.png) [@athenasaurav](https://forum.rasa.com/u/athenasaurav)\
**Post date:** [March 13, 2020, 5:16am UTC](https://forum.rasa.com/t/rasa-rest-api-implementation/25992/4 "2020-03-13T05:16:46Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![KarthiAru](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/karthiaru/32/7163_2.png) [@KarthiAru](https://forum.rasa.com/u/KarthiAru)\
**Post date:** [March 13, 2020, 6:32am UTC](https://forum.rasa.com/t/rasa-rest-api-implementation/25992/5 "2020-03-13T06:32:49Z")

</div>

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

You can check [How To Set Up a Firewall with UFW on Ubuntu 18.04 | DigitalOcean](https://www.digitalocean.com/community/tutorials/how-to-set-up-a-firewall-with-ufw-on-ubuntu-18-04) for allowing TCP traffic.

---

<div class="post-metadata">

**Author:** ![wabi](https://avatars.discourse-cdn.com/v4/letter/w/a3d4f5/32.png) [@wabi](https://forum.rasa.com/u/wabi)\
**Post date:** [March 19, 2020, 11:15pm UTC](https://forum.rasa.com/t/rasa-rest-api-implementation/25992/6 "2020-03-19T23:15:50Z")

</div>

check it for port 5005 Try this

> [http://34.69.54.64:5005/webhooks/rest/webhook](http://34.69.54.64:5005/webhooks/rest/webhook)

---

<div class="post-metadata">

**Author:** ![athenasaurav](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/athenasaurav/32/8139_2.png) [@athenasaurav](https://forum.rasa.com/u/athenasaurav)\
**Post date:** [March 20, 2020, 7:31pm UTC](https://forum.rasa.com/t/rasa-rest-api-implementation/25992/7 "2020-03-20T19:31:23Z")

</div>

I have reached some solution using [HTTP API](https://rasa.com/docs/rasa-x/api/rasa-x-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

---

<div class="post-metadata">

**Author:** ![wabi](https://avatars.discourse-cdn.com/v4/letter/w/a3d4f5/32.png) [@wabi](https://forum.rasa.com/u/wabi)\
**Post date:** [March 21, 2020, 8:03am UTC](https://forum.rasa.com/t/rasa-rest-api-implementation/25992/8 "2020-03-21T08:03:42Z")

</div>

@athenasaurav what have you received after testing send a screenshot

---

<div class="post-metadata">

**Author:** ![athenasaurav](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/athenasaurav/32/8139_2.png) [@athenasaurav](https://forum.rasa.com/u/athenasaurav)\
**Post date:** [March 21, 2020, 9:34am UTC](https://forum.rasa.com/t/rasa-rest-api-implementation/25992/9 "2020-03-21T09:34:22Z")

</div>

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.

 ![image](https://europe1.discourse-cdn.com/flex013/uploads/rasa/original/2X/4/45f77bc8472f477aababa808ddcd8f38c53316f0.png)

 ![image](https://europe1.discourse-cdn.com/flex013/uploads/rasa/original/2X/7/79496d12daaff7997bb64b5a48bfd7a441fb53a4.png)

---

<div class="post-metadata">

**Author:** ![small\_bob](https://avatars.discourse-cdn.com/v4/letter/s/4da419/32.png) [@small\_bob](https://forum.rasa.com/u/small_bob)\
**Post date:** [March 26, 2020, 3:03pm UTC](https://forum.rasa.com/t/rasa-rest-api-implementation/25992/10 "2020-03-26T15:03:58Z")

</div>

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:

> **[Rasa HTTP API](https://rasa.com/docs/rasa/http-api/)**
>
> Read about Rasa's HTTP API that has endpoints for conversations, training models, and configuring your bot.

[https://rasa.com/docs/rasa/1.9.1/api/http-api/#tag/Domain](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

---

<div class="post-metadata">

**Author:** ![athenasaurav](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/athenasaurav/32/8139_2.png) [@athenasaurav](https://forum.rasa.com/u/athenasaurav)\
**Post date:** [March 27, 2020, 10:13am UTC](https://forum.rasa.com/t/rasa-rest-api-implementation/25992/11 "2020-03-27T10:13:17Z")

</div>

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](http://localhost):port/webhooks/rest/webhook ‘’’ You will get all POST and get request in terminal windows 2 or here[[HTTP API](https://rasa.com/docs/rasa/1.9.2/api/http-api/)].

I have issues with rasa x http api [[HTTP API](https://rasa.com/docs/rasa-x/api/rasa-x-http-api/)] to fetch models and conversation and uploading models using http api on Gcloud.

---

<div class="post-metadata">

**Author:** ![small\_bob](https://avatars.discourse-cdn.com/v4/letter/s/4da419/32.png) [@small\_bob](https://forum.rasa.com/u/small_bob)\
**Post date:** [March 27, 2020, 2:33pm UTC](https://forum.rasa.com/t/rasa-rest-api-implementation/25992/12 "2020-03-27T14:33:19Z")

</div>

Thank you for the answer !

I managed to link it to my Rasa Core 🙂

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

---

<div class="post-metadata">

**Author:** ![athenasaurav](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/athenasaurav/32/8139_2.png) [@athenasaurav](https://forum.rasa.com/u/athenasaurav)\
**Post date:** [March 27, 2020, 5:36pm UTC](https://forum.rasa.com/t/rasa-rest-api-implementation/25992/13 "2020-03-27T17:36:54Z")

</div>

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

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

---

<div class="post-metadata">

**Author:** ![RedaElmar](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/redaelmar/32/10625_2.png) [@RedaElmar](https://forum.rasa.com/u/RedaElmar)\
**Post date:** [August 19, 2020, 8:41pm UTC](https://forum.rasa.com/t/rasa-rest-api-implementation/25992/14 "2020-08-19T20:41:15Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![athenasaurav](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/athenasaurav/32/8139_2.png) [@athenasaurav](https://forum.rasa.com/u/athenasaurav)\
**Post date:** [August 20, 2020, 7:36am UTC](https://forum.rasa.com/t/rasa-rest-api-implementation/25992/15 "2020-08-20T07:36:20Z")

</div>

Hello @RedaElmar,

Please share screenshot of what is happening

---

<div class="post-metadata">

**Author:** ![RedaElmar](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/redaelmar/32/10625_2.png) [@RedaElmar](https://forum.rasa.com/u/RedaElmar)\
**Post date:** [August 20, 2020, 4:57pm UTC](https://forum.rasa.com/t/rasa-rest-api-implementation/25992/16 "2020-08-20T16:57:24Z")

</div>

thank you @athenasaurav , here is the screens

 ![image](https://europe1.discourse-cdn.com/flex013/uploads/rasa/original/2X/c/cec979f24eedcafc016a2042da73950f9142e8b3.png) ![image](https://europe1.discourse-cdn.com/flex013/uploads/rasa/original/2X/b/b4f62f0f23e7aaae9defadce2e42fc45c54f8b5c.png)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 ![image](https://europe1.discourse-cdn.com/flex013/uploads/rasa/original/2X/d/defb23ffbe85a9d6d7100b32031b5951a0d46a5f.png)

---

<div class="post-metadata">

**Author:** ![athenasaurav](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/athenasaurav/32/8139_2.png) [@athenasaurav](https://forum.rasa.com/u/athenasaurav)\
**Post date:** [August 22, 2020, 8:58pm UTC](https://forum.rasa.com/t/rasa-rest-api-implementation/25992/17 "2020-08-22T20:58:44Z")

</div>

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

your code should be like this :

```auto
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'))

```
