Querying lists with dsquery
Every list endpoint accepts a dsquery parameter: a JSON object carrying the filter, sort and page in one place. Pass it URL-encoded in the query string:
curl -s "https://<gateway-host>/api/charging-sessions/v1" \
-H "API-KEY: wsk_..." \
--get --data-urlencode 'dsquery={"Pager":{"Skip":0,"Take":50},"Filter":{"Logic":"And","Filters":[{"Field":"Status","Operator":"Eq","Value":"4"}]},"Sort":{"Sorts":[{"Field":"StartedAtUtc","Dir":"Desc"}]}}'
The object has three optional parts:
{
"Pager": { "Skip": 0, "Take": 50 },
"Filter": { "Logic": "And", "Filters": [ … ] },
"Sort": { "Sorts": [ { "Field": "StartedAtUtc", "Dir": "Desc" } ] }
}
Property matching is case-insensitive, and enum values (Operator, Logic, Dir) are accepted by name or number. Omitting dsquery gives you the endpoint's defaults (typically the first 10, sorted by the endpoint's natural order).
Paging
Skip/Take are the authoritative pair — Skip rows from the start, return Take rows. Compare your running total against the response's TotalCount to know when to stop:
{ "Pager": { "Skip": 100, "Take": 50 } }
Keep Take reasonable (≤ 100); large pages help nobody.
Filtering
A filter is a tree: a Logic (And / Or) over a list of conditions, and any condition can itself be a nested group with its own Logic and Filters.
A flat AND:
{
"Logic": "And",
"Filters": [
{ "Field": "StartedAtUtc", "Operator": "Gte", "Value": "2026-08-01T00:00:00" },
{ "Field": "StartedAtUtc", "Operator": "Lt", "Value": "2026-09-01T00:00:00" }
]
}
A nested group — sessions that finished OR failed, within a period:
{
"Logic": "And",
"Filters": [
{ "Field": "StartedAtUtc", "Operator": "Gte", "Value": "2026-08-01T00:00:00" },
{ "Logic": "Or", "Filters": [
{ "Field": "Status", "Operator": "Eq", "Value": "4" },
{ "Field": "Status", "Operator": "Eq", "Value": "6" }
]}
]
}
Value is always a string, whatever the field's type — numbers, dates and enum values included.
Operators
| Operator | Meaning |
|---|---|
Eq / Neq | equals / not equals |
Lt / Lte / Gt / Gte | ordered comparisons (numbers, dates) |
Contains / StartsWith / EndsWith | string matching |
In | value in a comma-separated set |
GtLt, GteLte, GteLt, GtLte | range in one condition — Value is "low,high", letters say which ends are inclusive |
IsDate, IsMonth, IsYear, IsHour, IsMinute, IsSecond | timestamp truncation match — e.g. IsDate matches the whole calendar day |
Which fields are filterable?
Filter and sort fields are the response object's property names (PascalCase) of the list you're querying — Status, StartedAtUtc, Name, and so on. An unknown field returns a 400 naming the property rather than being silently ignored, so a typo is caught immediately.
Sorting
{ "Sorts": [ { "Field": "StartedAtUtc", "Dir": "Desc" }, { "Field": "Id", "Dir": "Asc" } ] }
Multiple entries apply in order. Dir is Asc or Desc.