Replies: 2 comments
-
Post discussing various ways that @renambot found. https://www.mscharhag.com/api-design/bulk-and-batch-operations |
Beta Was this translation helpful? Give feedback.
0 replies
-
1- might be safest to implement since completely new route For ws, probably easiest: if param is object -> normal, if array -> do the batch For return values: array of results when doing batches. I can't remember, do we use one ID per request ? would do one ID per batch then ? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Asked CHATGPT for some suggestions and my suggestions.
There are few ways to implement BATCH updates.
/api/batch
/api/batch
request call.POST
/api/COLLECTION_NAME
BODY
on the HTTP message is the document to add./api/COLLECTION_NAME/batch
BODY
on the HTTP message is an array of new docs.[{...}, {...}, {...}]
GET
/api/COLLECTION_NAME/:id
id
is in the route name.BODY
on the HTTP message is the document to add./api/COLLECTION_NAME/batch
[{...}, {...}, {...}]
PUT
/api/COLLECTION_NAME/:id
id
is in the route name.BODY
on the HTTP message is update message./api/COLLECTION_NAME/batch
BODY
on the HTTP message is an array of{id: string, update: any}
.[{id: '123', update: {...}}, {id:'234', update: {...}}]
DELETE
/api/COLLECTION_NAME/:id
id
is in the route name./api/COLLECTION_NAME/batch
['123', '234', '345']
batch
to the route request. If that query is provided then process request as a batch request.Beta Was this translation helpful? Give feedback.
All reactions