Query Cheatsheet¶
Quick reference for Centrali's canonical query model.
Start Here¶
- Query Records for the full guide
- Saved Queries for reusable named queries
- Text Search for search-focused patterns
- API Overview for route maps
Canonical Query Body¶
{
"resource": "orders",
"where": {
"and": [
{ "data.status": { "eq": "paid" } },
{ "data.amount": { "gte": 100 } }
]
},
"text": {
"query": "urgent"
},
"sort": [
{ "field": "createdAt", "direction": "desc" }
],
"page": {
"limit": 25,
"offset": 0
},
"select": {
"fields": ["id", "data.status", "data.amount"]
},
"include": [
{ "relation": "customerId" }
]
}
Operators¶
| Type | Operators |
|---|---|
| Comparison | eq, ne, gt, gte, lt, lte |
| List | in, nin |
| String | contains, startsWith, endsWith |
| Array | hasAny, hasAll |
| Existence | exists |
| Boolean logic | and, or, not |
Field Paths¶
- Use
data.for custom fields:data.status,data.amount - Top-level fields do not need
data.:id,createdAt,updatedAt,status - Nested JSON paths use dotted notation:
data.customer.email
GET Adapter¶
Use for simple, flat queries:
GET /data/workspace/{workspaceSlug}/api/v1/records/slug/{recordSlug}?data.status=paid&sort=-createdAt&pageSize=25
Common GET Params¶
| Param | Example |
|---|---|
| Exact match | ?data.status=paid |
| Operator | ?data.amount[gte]=100 |
| Search | ?search=urgent |
| Search fields | ?searchFields=data.title,data.notes |
| Sort | ?sort=-createdAt,data.priority |
| Paging | ?page=2&pageSize=25 |
| Projection | ?fields=id,data.status,createdAt |
| Expand | ?expand=customerId |
POST Query Endpoint¶
Use for rich queries:
Use POST when you need:
- Nested
and/or/not textselect.fieldsinclude- One query shape you can reuse in SDK code and saved queries
SDK¶
await centrali.records.query('orders', {
where: { 'data.status': { eq: 'paid' } },
sort: [{ field: 'createdAt', direction: 'desc' }],
page: { limit: 25 }
});
await centrali.records.list('orders', {
'data.status': 'paid',
sort: '-createdAt',
pageSize: 25
});
await centrali.records.search('orders', 'urgent', {
where: { 'data.priority': { eq: 'high' } },
page: { limit: 10 }
});
Compute Functions¶
const result = await api.queryRecords('orders', {
where: {
'data.status': { eq: 'pending' }
},
sort: [{ field: 'createdAt', direction: 'asc' }],
page: { limit: 100 }
});
Result Envelope¶
{
"data": [],
"meta": {
"limit": 25,
"offset": 0,
"hasMore": false,
"total": 0,
"processingTimeMs": 3,
"mode": "filter"
}
}
Saved Query Variables¶
Use canonical variable syntax inside saved query definitions:
Execute with:
When to Use What¶
- Use
records.listor GET routes for simple collection views - Use
records.queryorPOST /records/queryfor rich ad-hoc queries - Use
savedQuerieswhen the same query should be named, stored, and reused - Use
records.searchor atextclause when users type natural text