Create resource with relation with User Collection but user field not get filled

System Information
  • Strapi Version: 4.5.3
  • Operating System: MacOS 13.0.1
  • Database: SQLite
  • Node Version: 16.13.2
  • NPM Version: 8.5.5
  • Yarn Version: 1.22.19

Hello everyone,

I am playing around with Strapi and I am kind of stuck here and don’t know how to get my model working. I hope someone can shed light on my problem. I want to save a comment on a unit together with its author information.

My model was created in Strapi Admin UI:

1. Default User Collection
2. Unit Collection
3. Comment Collection
   - comment_author (User (from users-permissions) has many comments)
   - unit (unit has many comments)
   - comment_content
   - comment_parent 

I also enabled create, find, findOne endpoints for Comment Collection.

I did a post request to create a new comment in Postman:

curl --location --request POST 'http://localhost:1337/api/comments' \
--header 'Authorization: Bearer __TOKEN_OMITTED__ \
--header 'Content-Type: application/json' \
--data-raw '{
    "data": {
        "comment_author": 3,
        "unit": 4,
        "comment_content": "This is a test comment",
        "comment_parent": 0

User with id = 3, is an authenticated user in User collection.
Unit with id = 4, is an unit exists in Unit Collection.

The result is: every field gets saved but comment_author. I also blindly experimented other relationship type between comment collection and user collection without success. The comment_author field stay not filled.


Did you get this working, facing a very similar issue.