Skip to content

Entity REST API (mutations)

Insert / update / delete endpoints auto-exposed per entity. Filters, sort, select, paging: REST API (read).

We'll use the products entity (id 7) as the example.

Http MethodDescriptionexamplerequiresreturns
POSTinsert one row (body = row)/api/productsallowApiInsertthe new row
POSTinsert many (body = array of rows)/api/productsallowApiInsertarray of new rows
PUTupdate one row by id/api/products/7allowApiUpdatethe updated row
DELETEdelete one row by id/api/products/7allowApiDeleteempty
PUTupdate all rows matching the query filter/api/products?category=booksallowApiUpdate{ "updated": n }
DELETEdelete all rows matching the query filter/api/products?category=booksallowApiDelete{ "deleted": n }

Collection-level PUT / DELETE (no id) require a non-empty filter — or where: "all" via POST __action.

POST without __action is always insert. Read operations use __action=get|count|groupBy|query — see REST API (read).

Select on write

_select=none skips returning the row (empty body).

POST /api/products?_select=none
PUT  /api/products/7?_select=none

Actions

POST /api/products?__action=<action>. deleteMany and updateMany require where in the body. Query-string filters still apply; where uses the same operator keys as read filters.

__actionbodyreturnsrequires
deleteMany{ "where": ... } or { "where": "all" }{ "deleted": n }allowApiDelete
updateMany{ "where": ..., "set": ... }{ "updated": n }allowApiUpdate
upsertMany[{ "where": ..., "set": ... }, ...]array of upserted rowsinsert/update

deleteMany

POST /api/products?__action=deleteMany
JSON
{ "where": { "category": "books" } }
JSON
{ "deleted": 4 }

{ "where": "all" } deletes every row.

updateMany

POST /api/products?__action=updateMany
JSON
{
  "where": { "category": "books" },
  "set": { "inStock": false }
}
JSON
{ "updated": 4 }

{ "where": "all", "set": { ... } } updates every row.

Collection PUT / DELETE with query-string filters are the same operations when the filter is simple.

upsertMany

POST /api/products?__action=upsertMany
JSON
[
  { "where": { "sku": "abc" }, "set": { "price": 9 } },
  { "where": { "sku": "xyz" }, "set": { "price": 12 } }
]

Match by where; update with set if found, otherwise insert where + set. Returns the upserted rows. set may be omitted to ensure the row exists without changing it.

insert many

POST /api/products with an array body (no __action):

JSON
[
  { "name": "Pencil", "price": 1 },
  { "name": "Eraser", "price": 2 }
]

Returns the created rows.

MIT Licensed | Made by the Remult team with ❤️