On my current project I'm using a loopback backend as the REST API. My question is actually quite simple, but I wasn't able to figure it out on my own.
On my client I have a bulk of message objects which are updated by the user - these can add up to 50-100 messages.
Now I want to update the items using the loopback backend. There are some default endpoints which support PUT or PATCH methods. However, as soon as I pass an array I receive an error message, complaining that the item with the id already exists.
It seems wrong to me to just fire up 100 HTTP-Requests just to update a bunch of items. Any suggestions?
For completeness - here the error message.
{
"error": {
"name": "Error",
"status": 500,
"message": "Failed with multiple errors, see `details` for more information.",
"details": [
{
"code": 11000,
"index": 0,
"errmsg": "E11000 duplicate key error collection: xxx.Message index: _id_ dup key: { : ObjectId('588bc0afcf8d8c7b13ff44e2') }",
"op": {
// message object
}
}
}