API filtering example¶
This page shows query patterns supported by QueryStringManager and consumed by the Django ORM data layer.
Full filter syntax¶
Simple filter syntax¶
Relationship-style field path¶
GET /customers?filter[group.id]=1
GET /computers?filter[owner.email][email protected]
Combined with sort + pagination¶
import httpx
response = httpx.get(
"http://localhost:8000/api/customers",
params={
"filter[status]": "active",
"sort": "-created_at",
"page[size]": 20,
"page[number]": 1,
},
)
print(response.json())
Response excerpt¶
{
"links": {
"self": "http://localhost:8000/api/customers?filter%5Bstatus%5D=active&sort=-created_at&page%5Bsize%5D=20&page%5Bnumber%5D=1"
},
"data": [
{
"type": "customer",
"id": "1",
"attributes": {
"name": "John",
"status": "active"
},
"links": {
"self": "http://localhost:8000/api/customers/1/"
}
}
]
}
Notes¶
- Keep
filterURL-encoded in real clients. - Supported operators depend on your data-layer mapping.