Filtering
Contit uses a powerful structured filter system based on FilterConditionGroup — a recursive, composable tree of AND/OR conditions.
Basic filter
{
"page": 1,
"pageSize": 20,
"filter": {
"type": "condition",
"fieldKey": "status",
"operator": "e",
"value": "active"
}
}
AND / OR groups
{
"filter": {
"type": "and",
"conditions": [
{ "type": "condition", "fieldKey": "category", "operator": "e", "value": "news" },
{ "type": "condition", "fieldKey": "published", "operator": "e", "value": true }
]
}
}
Nested groups
{
"filter": {
"type": "and",
"conditions": [
{
"type": "or",
"conditions": [
{ "type": "condition", "fieldKey": "brand", "operator": "e", "value": "A" },
{ "type": "condition", "fieldKey": "brand", "operator": "e", "value": "B" }
]
},
{ "type": "condition", "fieldKey": "price", "operator": "gt", "value": 0 }
]
}
}
Filter operations
| JSON value | C# enum | Description |
|---|---|---|
e |
Equal |
Exact match |
ne |
NotEqual |
Not equal |
in |
Contains |
Array contains value |
nin |
NotContains |
Array does not contain |
like |
StringContains |
String substring match |
nlike |
StringNotContains |
String not containing |
start |
StartsWith |
String starts with |
end |
EndsWith |
String ends with |
lt |
LessThan |
Less than |
lte |
LessThanOrEqual |
Less than or equal |
gt |
GreaterThan |
Greater than |
gte |
GreaterThanOrEqual |
Greater than or equal |
noe |
NullOrEmpty |
Null or empty check |
nnoe |
NotNullOrEmpty |
Not null or empty |
def |
Defined |
Field exists |
ndef |
NotDefined |
Field does not exist |
distance |
Distance |
Geo proximity (GeoLocation fields) |
Filter condition types
| JSON value | C# enum | Description |
|---|---|---|
and |
And |
All conditions must match |
or |
Or |
At least one condition must match |
condition |
Condition |
Single filter rule |
System fields
Filter on built-in metadata using the sysfield. prefix:
| Key | Type | Description |
|---|---|---|
sysfield.id |
string | Content item ID |
sysfield.dateInsert |
DateTime | Creation date |
sysfield.lastUpdate |
DateTime | Last modification date |
{ "type": "condition", "fieldKey": "sysfield.lastUpdate", "operator": "gt", "value": "2025-01-01T00:00:00Z" }
JSON dot notation
For fields of type Json, use dot notation to query nested properties:
| Syntax | Meaning | Example |
|---|---|---|
address.city |
Nested property | Access city inside address object |
tags[0] |
Array index | First element of tags array |
items[].name |
All array elements | Matches name in any item (JOIN) |
items[0].name |
Specific element property | name of the first item |
"api.version" |
Key containing a dot | Use quotes for keys with dots |
Example
{
"filter": {
"type": "and",
"conditions": [
{ "type": "condition", "fieldKey": "address.city", "operator": "e", "value": "Milan" },
{ "type": "condition", "fieldKey": "items[].qty", "operator": "gt", "value": 0 }
]
}
}
.NET SDK
var response = await client.Content.Get<MyModel>("products", new ContentsRequest
{
Page = 1,
PageSize = 20,
Filter = new FilterConditionGroup
{
Type = FilterConditionType.And,
Conditions =
[
new FilterConditionGroup
{
Type = FilterConditionType.Or,
Conditions =
[
new FilterCondition("brand", FilterOperation.Equal, "A"),
new FilterCondition("brand", FilterOperation.Equal, "B")
]
},
new FilterCondition("price", FilterOperation.GreaterThan, 0),
new FilterCondition("sysfield.lastUpdate",
FilterOperation.GreaterThan, DateTime.Now.AddDays(-7))
]
}
});
Note: In the .NET SDK, use the C# enum names (
FilterOperation.Equal,FilterConditionType.And). The SDK serializes them to the JSON values ("e","and") automatically.