API - PATCH
In nodb PATCH requests follows restful pattern to merge entities with the body payload.
In your HTTPS request body payload must be array of entities, not just an object. If you send an object the request will fail.
Here's the difference between PATCH requests with POST and PUT:
PATCH [{ id, ... }, {...}, { id, ... }] -> update two, ignore one
POST [{ id, ... }, {...}, { id, ... }] -> replace two, insert one
PUT [{ id, ... }, {...}, { id, ... }] -> replace two, ignore one
For PATCH requests only items with id
will be considered.
Merging (updating) entities with new ones
Requests are sent to named routes. If you send requests to a single entity the request will fail (for example to a /names-route/43sdh9bi
route).
We send entities to the 'named-route' just as an example:
curl -X PUT https://api.nodb.sh/{app-name}/{env}/named-route?token={token} \
-d '[{ "id": "kzw1q9dz", "foo": "bar" }, { "abc": 123 }]'
Item with prop 'abc' will be ignored.