Here's my Todo model structure:
Todo
- title (Text)
- description (Text)
- completed (Boolean)
- users_permissions_user (Relation with User from users-permissions)
User
- username (Text)
- email (Email)
- provider (Text)
- password (Password)
- resetPasswordToken (Text)
- confirmationToken (Text)
- confirmed (Boolean)
- blocked (Boolean)
- role (Relation with Role from users-permissions)
- todos (Relation with Todo)
I've tried to create a Todo with the following request body:
{
"data": {
"title": "Your Todo Title",
"description": "Your Todo Description",
"completed": false,
"users_permissions_user": {
"connect": [3] // Replace with the actual user ID
}
}
}
But I'm getting this error:
{
"data": null,
"error": {
"status": 400,
"name": "ValidationError",
"message": "Invalid key users_permissions_user",
"details": {
"key": "users_permissions_user",
"path": "users_permissions_user",
"source": "body"
}
}
}
I've also tried variations like:
{
"data": {
"title": "Your Todo Title",
"description": "Your Todo Description",
"completed": false,
"users_permissions_user": 3
}
}
And:
{
"data": {
"title": "Your Todo Title",
"description": "Your Todo Description",
"completed": false,
"users_permissions_user": {
"id": 3
}
}
}
But I'm still getting the same error.
How can I properly associate a user with a Todo item during creation in Strapi v5? Am I missing something in my model configuration or API request?