Is there a way to create a POST request in which I define a relation to user?

I’ve created a POST request to upload data into my Codes content-type, which also has a many-to-one relation with users-permissions plugin. Is there any way to send a POST request in which I define what user the entry belongs to?

Here is how I tried to create the request using raw JSON in Postman:
{
“data”:{
“title”:“Simple title”,
“desc”:“Short desc”,
“language”:“C/C++”,
“difficulty”:“10”,
“guidetext”:“Some text”,
“user”:1,
“author”:“tester”
}
}
Strapi handled this fine, Postman returned all data in the response.

And here’s the result in Strapi:

As you can see, no relation to users_permission_user is defined. I’ve tried replacing user in my json request with user.id, users_permission_user as well as users-permission.user but to no avail.

Is there any way to correctly refer to the user’s ID in my POST request?

1 Like

have you found any solution?

i had similar problem but i managed to figure it out.
the problem is that you didn’t give permission to find the user.
under: settings/USERS & PERMISSIONS PLUGIN/Roles/ Authenticated /users-permissions
enable find user.
and i think in your data you are trying to post change “user” to “users-permissions_user” because this is how you named the field .

i am trying to solve same problem about 1 hour, your post helped me thanks