Pottr/Docs
Topic:Querying Data (Filtering & Sorting)
REST API
.md

Querying Data (Filtering & Sorting)

Pagination parameters, sorting directives, field equality filters, and batch ID retrieval.

Query Parameters Reference

ParameterTypeDefaultDescription
limitInteger20Number of entries to return. Maximum value is 100.
offsetInteger0Number of entries to skip for pagination.
order_byStringcreated_atSort field: created_at, updated_at, or any custom schema field key.
orderStringDESCSort direction: ASC (ascending) or DESC (descending).
filter[key]String—Equality filter on any schema field (e.g. filter[status]=active). The long form filter[status][value]=active is equivalent. Unknown field keys are ignored.
where[key]String—Alias for filter[key].
formatString—standard returns the uniform response envelope. See API Overview.
idsString—Comma-separated list of entry IDs to fetch directly (e.g. ?ids=1,2,5).
expandString—Relation field key. The related entry is inlined one level deep; deeper relations are not followed.

Filtering Examples

Multiple filters combine automatically with boolean AND. A bare field query such as ?status=active also works as a filter, as long as the name is not a reserved parameter (limit, offset, order_by, order, expand, ids, filter, where, format):

cURL Query Example
# Filter active projects, sorted by updated date, page 2:
curl -H "Authorization: Bearer pk_live_..." \
  "https://example.com/wp-json/pottr/v1/collections/project?filter\[status\]=active&filter\[category\]=design&order_by=updated_at&order=DESC&limit=10&offset=10"

Batch ID Lookups

To fetch specific entries without manual iterative loops, pass ?ids=101,102,105. Batch queries maintain full row-level security for user-owned collections.