Post Returns Null

System Information
  • Strapi Version: v3.3.3
  • Operating System: Debian GNU/Linux 9
  • Database: Postgres
  • Node Version: v12.20.1
  • NPM Version: 6.14.10
  • Yarn Version: 1.22.5

I have a collection-type called Site Messages. I am able to execute all CRUD operations through the admin site. When I use Postman to create a new site-message using the following raw body:
{
“name”: “Fake Person”,
“email”: “fake.person@gmail.com”,
“phone”: “555-555-5555”,
“message”: “Test”,
}
I get the following response:
{
“id”: 38,
“name”: null,
“email”: null,
“phone”: null,
“message”: null,
“created_at”: “2021-01-24T21:52:34.592Z”,
“updated_at”: “2021-01-24T21:52:34.592Z”
}
I expect to receive the following response:

{
    "id": 38,
    "name": "Fake Person",
    "email": "fake.person@gmail.com",
    "phone": "555-555-5555",
    "message": "Test",
    "created_at": "2021-01-24T21:52:34.592Z",
    "updated_at": "2021-01-24T21:52:34.592Z"
}

At one point I modified the controller api/site-messages/controllers/site-messages.js, but I have reverted it back to it’s original state:
‘use strict’;

/**
 * Read the documentation (https://strapi.io/documentation/v3.x/concepts/controllers.html#core-controllers)
 * to customize this controller
 */

module.exports = {};

When I try sending POST requests to other content-types I get the some result of null for all the fields.

Did you set the raw body to json?

1 Like

That was it. Thanks!