System Information
- Strapi Version: 3.6.8:
- Database: Sqlite:
I am using component to build my relation like this:
{
"kind": "collectionType",
"collectionName": "books",
"info": {
"name": "Books",
"description": ""
},
"options": {
"increments": true,
"timestamps": true,
"draftAndPublish": true
},
"pluginOptions": {},
"attributes": {
"booktitle": {
"type": "string"
},
"authors": {
"type": "component",
"repeatable": true,
"component": "books.authors"
}
}
}
The problem is when I am creating a new book, even when I add the ID of author like below, it doesn’t care, and will create a new author with new ID, but if I send a put request with the same JSON structure it notice the ID and will not create a new author record! Why it is not working in post request? Am I missing something?
JSON data, which I use for POST and PUT request:
{"booksubtitle":"test","authors":[{"id":4,"author":"test author"},{"id":5,"author":"1"},{"id":6,"author":"2"}]}
The POST response:
{
"id": 5,
"booktitle": "test",
"authors": [
{
"id": 13,
"author": "test author"
},
{
"id": 14,
"author": "1"
},
{
"id": 15,
"author": "2"
}
]
}
The PUT response:
{
"id": 2,
"booktitle": "test",
"authors": [
{
"id": 4,
"author": "test author"
},
{
"id": 5,
"author": "1"
},
{
"id": 6,
"author": "2"
}
]
}