Problem with Post action on Strapi via Postman

Viewed 1726

The problem is I can't perform PUT or POST with Postman app. But DELETE is possible. And yes I enabled all actions for public users.

Here is GET request result:

{
    "data": [
        {
            "id": 2,
            "attributes": {
                "title": "23123",
                "game": "1231",
                "players": "2312313",
                "createdAt": "2022-02-19T16:36:34.221Z",
                "updatedAt": "2022-02-19T16:36:34.971Z"
            }
        }
    ],
    "meta": {
        "pagination": {
            "page": 1,
            "pageSize": 25,
            "pageCount": 1,
            "total": 1
        }
    }
}

And here is my entries for POST request: enter image description here

finally after requesting POST here is result:

{
    "data": null,
    "error": {
        "status": 400,
        "name": "ValidationError",
        "message": "Missing \"data\" payload in the request body",
        "details": {}
    }
}

What is the problem?

1 Answers

I finally found the solution. u need to put Body in raw and set it as Json! default is Text.

and POST example is :

 {

  "data": {
    "title": "Hello",
    "relation": 2,
    "relations": [2, 4]
  }
 }
Related