# Rasa HTTP POST error

**URL:** <https://forum.rasa.com/t/rasa-http-post-error/15979>\
**Category:** Rasa Open Source\
**Created:** [September 20, 2019, 7:29am UTC](https://forum.rasa.com/t/rasa-http-post-error/15979 "2019-09-20T07:29:44Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![GauravRoy48](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/gauravroy48/32/5063_2.png) [@GauravRoy48](https://forum.rasa.com/u/GauravRoy48)\
**Post date:** [September 20, 2019, 7:29am UTC](https://forum.rasa.com/t/rasa-http-post-error/15979/1 "2019-09-20T07:29:45Z")

</div>

I’m trying to run this command

`curl http://localhost:5005/webhooks/rest/webhook -d ‘{"sender":"default","message":"hi"}’`

and the rasa core keeps throwing the error

> ```
> [2019-09-20 12:58:02 +0530] [4668] [ERROR] Exception occurred while handling uri: 'http://localhost:5005/webhooks/rest/webhook'
> Traceback (most recent call last):
> File "d:\softwares\anaconda\anaconda3\envs\cbot\lib\site-packages\sanic\request.py", line 149, in load_json
> self.parsed_json = loads(self.body)
> File "d:\softwares\anaconda\anaconda3\envs\cbot\lib\json\ __init__.py", line 349, in loads
> s = s.decode(detect_encoding(s), 'surrogatepass')
> UnicodeDecodeError: 'utf-8' codec can't decode byte 0x91 in position 0: invalid start byte
> 
> During handling of the above exception, another exception occurred:
> 
> Traceback (most recent call last):
> File "d:\softwares\anaconda\anaconda3\envs\cbot\lib\site-packages\sanic\app.py", line 917, in handle_request
> response = await response
> File "d:\softwares\anaconda\anaconda3\envs\cbot\lib\site-packages\rasa\core\channels\channel.py", line 439, in receive
> sender_id = await self._extract_sender(request)
> File "d:\softwares\anaconda\anaconda3\envs\cbot\lib\site-packages\rasa\core\channels\channel.py", line 392, in _extract_sender
> return req.json.get("sender", None)
> File "d:\softwares\anaconda\anaconda3\envs\cbot\lib\site-packages\sanic\request.py", line 143, in json
> self.load_json()
> File "d:\softwares\anaconda\anaconda3\envs\cbot\lib\site-packages\sanic\request.py", line 153, in load_json
> raise InvalidUsage("Failed when parsing body as json")
> sanic.exceptions.InvalidUsage: Failed when parsing body as json
> 
> ```

I’ve used the following code to bring up the server:

`rasa run -m models --enable-api --log-file out.log`

The model that is running is the model that I get when i run `rasa init --no-prompt`

---

<div class="post-metadata">

**Author:** ![erohmensing](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/erohmensing/32/1789_2.png) [@erohmensing](https://forum.rasa.com/u/erohmensing)\
**Post date:** [September 20, 2019, 8:25am UTC](https://forum.rasa.com/t/rasa-http-post-error/15979/2 "2019-09-20T08:25:01Z")

</div>

Mmm, it’s possible that you have the curly quote `’` instead of the straight one `'` and that is messing it up – they’re quite finnicky and I’ve definitely run into that problem when copying a statement from the internet where straight quotes are always rendered as the prettier ones (which are actually completely different characters)!

---

<div class="post-metadata">

**Author:** ![GauravRoy48](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/gauravroy48/32/5063_2.png) [@GauravRoy48](https://forum.rasa.com/u/GauravRoy48)\
**Post date:** [September 20, 2019, 9:38am UTC](https://forum.rasa.com/t/rasa-http-post-error/15979/3 "2019-09-20T09:38:34Z")

</div>

I took care of all the syntax related errors by typing out the entire code.

Now i get this error

```
[2019-09-20 15:04:31 +0530] [12188] [ERROR] Exception occurred while handling uri: 'http://localhost:5005/webhooks/rest/webhook'
Traceback (most recent call last):
  File "d:\softwares\anaconda\anaconda3\envs\cbot\lib\site-packages\sanic\request.py", line 149, in load_json
    self.parsed_json = loads(self.body)
  File "d:\softwares\anaconda\anaconda3\envs\cbot\lib\json\ __init__.py", line 354, in loads
    return _default_decoder.decode(s)
  File "d:\softwares\anaconda\anaconda3\envs\cbot\lib\json\decoder.py", line 339, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "d:\softwares\anaconda\anaconda3\envs\cbot\lib\json\decoder.py", line 357, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "d:\softwares\anaconda\anaconda3\envs\cbot\lib\site-packages\sanic\app.py", line 917, in handle_request
    response = await response
  File "d:\softwares\anaconda\anaconda3\envs\cbot\lib\site-packages\rasa\core\channels\channel.py", line 439, in receive
    sender_id = await self._extract_sender(request)
  File "d:\softwares\anaconda\anaconda3\envs\cbot\lib\site-packages\rasa\core\channels\channel.py", line 392, in _extract_sender
    return req.json.get("sender", None)
  File "d:\softwares\anaconda\anaconda3\envs\cbot\lib\site-packages\sanic\request.py", line 143, in json
    self.load_json()
  File "d:\softwares\anaconda\anaconda3\envs\cbot\lib\site-packages\sanic\request.py", line 153, in load_json
    raise InvalidUsage("Failed when parsing body as json")
sanic.exceptions.InvalidUsage: Failed when parsing body as json
```

---

<div class="post-metadata">

**Author:** ![Krogsager](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/krogsager/32/95_2.png) [@Krogsager](https://forum.rasa.com/u/Krogsager)\
**Post date:** [September 20, 2019, 10:49am UTC](https://forum.rasa.com/t/rasa-http-post-error/15979/4 "2019-09-20T10:49:08Z")

</div>

Like the error says, the program failed to parse the string as json. Step 1 would be to validate your json syntax with a linter. E.g. [https://jsonlint.com/](https://jsonlint.com/)

---

<div class="post-metadata">

**Author:** ![GauravRoy48](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/gauravroy48/32/5063_2.png) [@GauravRoy48](https://forum.rasa.com/u/GauravRoy48)\
**Post date:** [September 20, 2019, 11:57am UTC](https://forum.rasa.com/t/rasa-http-post-error/15979/5 "2019-09-20T11:57:39Z")

</div>

> [@GauravRoy48](#):
>
> curl [http://localhost:5005/webhooks/rest/webhook](http://localhost:5005/webhooks/rest/webhook) -d ‘{“sender”:“default”,“message”:“hi”}’

This is all that i typed on the command prompt

---

<div class="post-metadata">

**Author:** ![mrangach](https://avatars.discourse-cdn.com/v4/letter/m/57b2e6/32.png) [@mrangach](https://forum.rasa.com/u/mrangach)\
**Post date:** [October 27, 2020, 6:19pm UTC](https://forum.rasa.com/t/rasa-http-post-error/15979/6 "2020-10-27T18:19:18Z")

</div>

Hi, were u able to resolve this issue. pls advice on the solution
