Working with data
Filtering by headless fields
Custom (headless) fields let you attach arbitrary key/value data to entities. Supported endpoints can filter on those fields with the fields[...] query syntax.
Where it works
Headless-field filtering is currently supported on:
- Custom content -
GET /custom/ - Product categories -
GET /products/categories/ - Product tags -
GET /products/tags/
Note
These three endpoints are the only ones that support
fields[...] filtering. It does not apply to the main GET /products/ product list, nor to custom categories or tags.Query syntax
Filters are query-string arrays. Each matcher targets a field key:
| Parameter | Match |
|---|---|
fields[item_group]=<group> | Restrict to a group (optional) |
fields[item_key][<key>]=<value> | Exact match |
fields[item_key_contains][<key>]=<value> | Contains |
fields[item_key_starts_with][<key>]=<value> | Starts with |
fields[item_key_ends_with][<key>]=<value> | Ends with |
curl -s -G "https://api.readycms.io/custom/?namespace=<tenant>&custom_type=posts" \ -H "Authorization: Bearer <app_id>:<app_secret>" \ --data-urlencode "fields[item_key][featured]=yes" \ --data-urlencode "fields[item_key_contains][region]=eu"
Semantics
- All key/value matchers are combined with AND.
item_groupis optional. Providing only a group (no matchers) means "the entity has any field in this group".
Note
Field matching is exact or substring depending on the matcher you choose. Combine several matchers to narrow results.