What it does
Query rows in a table. query takes where, any (AND-ed with where when both are set), search (web-search syntax: a OR b, "phrase", -word; with snippets), similar_to, sort, page, limit, group_by, aggregates, or include, fields to return only some columns (key:N excerpts, length(key)), meta min for id and revision only, count_only for just the total, member (a member id from list_members) for one site member's rows, and visibility (shared, private or all) on an own_and_shared table. Each row has _member: the member it belongs to, or null. _created_by and _updated_by say who wrote it: { type (bot, owner, member, visitor, reviewer or system), agent_id for an agent, name }, with the current name. Sort keeps the first occurrence of each column and allows at most 5 distinct columns.
The same search and where as query_table.
Plans
Works on every plan: Free, Basic, Pro and Ultra.
Parameters
| Name | Type | About |
|---|---|---|
namerequired | string | The table to read. |
query | object | Query options: where, search, sort, limit, page and the others query_table takes. |
fields | array of string | Column keys to return, such as ["slug","title"]. key:N returns the first N characters of a text column (rows it cut list it in _truncated); length(key) returns length_<key>, its length in characters. id, position, revision, created_at, updated_at, _member, _created_by and _updated_by always come back (only id and revision with meta min). Filters, search and sort can use other columns. Not with group_by or aggregates. It keeps long text columns out of the response. |
site_id | string | Only for a site shared with you (whoami lists them): read or change that site's data as its member. |
Example
Call list_rows with these arguments:
{
"name": "recipes",
"fields": [
"title",
"minutes"
]
}
Ids like 01a1… stand for your own. list_sites and list_tables give you the real ones.
Related guides
- Search, filters and pagingLet visitors find rows in a long table.
- Count, find and change many rowsYour agent answers questions about a table without reading every row.