Selecting content
Every content listing on the platform is asked the same way: one set of keys, one validator, one
meaning. The admin API and the public API speak it on the same endpoint — a query string on GET,
the same keys as a JSON body on POST … /query. A few families also offer a plain skip/take list
next to their content listing; where they do, it is a separate operation, not a second vocabulary for
this one.
The shape of a request
curl "$CONTENT_API/pages?template=post&path=/news&filter[categories]=release~notes&sort=published:desc&page=2&hitsPerPage=12&facets=categories"
| Key | Meaning |
|---|---|
template |
Narrow to one template, by alias. templateId does the same by identifier |
path |
Children of that path — one level, not the whole subtree |
filter[<path>] |
One condition, one entry per field path (below) |
sort |
<path>, <path>:asc, <path>:desc, or a named order: relevance, newest |
page |
One-based page number. Default 1 |
hitsPerPage |
Page size, 1…200. Default 24 |
facets |
Comma-separated field paths whose value counts come back with the answer |
template and path narrow the selection, not the values: a request that names both lists the
children of that path that were built from that template.
The answer reports the window it actually used next to pages and total; the numbers it reports
are explained under Pages and windows.
Conditions
Each condition is its own parameter, keyed by field path:
| Form | Meaning |
|---|---|
filter[price]=1000 |
Equals |
filter[categories]=release~notes |
Any of a set — ~ separates values |
filter[price]=1000..5000 |
A range. Either bound may be open: 1000.., ..5000 |
filter[spec.material]=steel |
A nested field path. filter[spec][material] means the same thing |
A range is only a range on a numeric or date field. On a text field foo..bar is an ordinary value,
because it is an ordinary page title too — the parser never invents a refusal.
Repeating the parameter adds values, so filter[categories]=a&filter[categories]=b is the set
a~b. Values are trimmed; an empty value is refused as filter-value-invalid, not read as "no
condition". A filter entry that is not a path and a value at all is refused as filter-shape.
A path is filterable when the template declares it. Anything else is refused with
filter-path-not-declared and the list of paths that template does declare — the answer is a
sentence about the template, not a guess about a typo.
Ordering
sort takes a declared field path, optionally with a direction; ascending is the default. Two words
are orders of their own rather than paths: relevance — with newest standing in when there is no
score to sort by — and newest.
Ordering is stable: items with no value for the sorted field land last, and ties break on the record's own order, so consecutive pages never overlap and never lose a row.
Pages and windows
page counts from 1, hitsPerPage runs 1…200. A value that is not a number, or that falls
outside the range, takes the default instead of refusing the request. A page number beyond the last
one is an empty page, not an error.
The answer always reports limit and offset, whatever the request said — page: 2 with
hitsPerPage: 12 answers limit: 12, offset: 12. A caller that stores the offset can therefore page
with either vocabulary.
Facets
facets names the paths whose counts you want — comma-separated, or repeated: facets=a,b means
the same as facets=a&facets=b. A path is facetable only if the template declares it filterable;
otherwise the answer is filter-path-not-declared with the declared list.
"facets": [
{
"path": "categories",
"label": "Categories",
"type": "text",
"values": [{ "value": "release", "count": 12 }, { "value": "notes", "count": 3 }]
}
]
Two rules make the numbers usable as a filter panel:
- A facet never narrows itself. The count for
categoriesis computed with the filter on every other path applied and the filter oncategoriesleft out — otherwise every value would show its own already-narrowed count and a reader could never switch values. - Counts come back biggest first, ties broken by the value, so a panel does not reshuffle between requests.
The same panel answers on GET …/filters: that call takes the same base filters, and without
facets it returns every filterable path of the template. It is what a filter UI asks before it
shows anything.
Refusals
Every refusal names the problem and, where it can, the path it is about:
| Code | What went wrong |
|---|---|
filter-shape |
A filter[…] entry that is not a path and a value |
filter-path-not-declared |
The path is not declared by the template. The answer lists the declared ones |
filter-value-invalid |
An empty value, or a value the declared type cannot read |
sort-invalid |
A direction that is neither asc nor desc |
sort-path-not-declared |
The sort path is not declared. The answer lists the declared ones |
template-unsupported |
The templates of that surface have no alias, so template cannot narrow anything there — name the template by identifier instead |
Related
- Generate a typed client — the same keys through the typed client.
- First content — the read that returns one record by path.
- Admin API reference — the entity resources that accept the language.