pagehive

update_rows

Write the same column values to every row a filter matches, without reading their ids first.

TablesChanges dataAll plansUpdated

What it does

Write the same column values to every row a filter matches, without reading their ids first. where, any and search work as in query_table. expect_count, the number of rows you expect, is required: when the filter matches another number, nothing is written (409 validation_failed reason count_mismatch, with matched). At most 500 rows per call; a call without where, any or search is refused. Answers matched, updated and the ids.

Plans

Works on every plan: Free, Basic, Pro and Ultra.

Parameters

NameTypeAbout
namerequiredstringThe table.
whereobjectFilters by column, as in query_table: the rows to change.
anyarray of objectsA list of where filters, of which at least one must match.
searchstringText to find in the table's searchable columns.
visibilityone of: shared, private, allOnly for an own_and_shared table. shared: rows that belong to no member. private: your own private rows (the owner: every member's). all, the default: everything you may read, so the shared rows plus your own.
setrequiredobjectColumn values to write to each matched row. null clears a column.
expect_countrequiredintegerHow many rows the filter should match.
site_idstringOnly for a site shared with you (whoami lists them): read or change that site's data as its member.

Example

Call update_rows with these arguments:

{
  "name": "tasks",
  "where": {
    "status": "open"
  },
  "set": {
    "status": "done"
  },
  "expect_count": 12
}

Ids like 01a1… stand for your own. list_sites and list_tables give you the real ones.

Related guides