Slim 4 - Get JSON Body

Hi,

what is the best way to get the body in JSON data format?

I’m sending with postman a request to my api which is build with slim 4 with the following content:
{
“message”: “test message”
}

and Content-Type: application/json

If I’m reading the body with $request->getParsedBody() it’s null. Any idea what would be the problem?

Thanks in advance

Hi @ino, welcome! :wave:

I would recommend that you take a look at this blog post, literally posted earlier today: https://akrabat.com/receiving-input-into-a-slim-4-application/

1 Like