OData query options cheat sheet
OData services share one URL grammar for querying entity sets. The options below go into the query
string after the entity set, for example People?$filter=…&$top=10. Each Try it link opens the viewer with
the query already filled in and runs it against the public sample service — no URL typing, and the exact
request URL is shown next to the results.
$filter — which rows
| Purpose | Expression | Try it |
|---|---|---|
| Equality | FirstName eq 'Scott' |
TripPin People |
| Comparison | UnitPrice gt 50 |
Northwind Products |
| Logical | UnitPrice gt 20 and Discontinued eq false |
Northwind Products |
| String function | startswith(CompanyName,'A') (V4), startswith(CompanyName,'A') eq true (V2) |
Northwind Customers |
| Contains | contains(ProductName,'Chef') (V4), substringof('Chef',ProductName) (V2) |
Northwind Products |
Operators: eq, ne, gt, ge, lt, le, and, or, not, in (V4.01). Strings use single quotes;
a quote inside a string is doubled ('O''Neil'). Dates are 2026-10-19 (V4) or datetime'2026-10-19T00:00:00' (V2).
$select — which columns
$select=FirstName,LastName returns only these properties, which keeps responses small on wide SAP entities.
Try it on TripPin.
$orderby — sorting
$orderby=UnitPrice desc sorts descending; several keys are comma-separated (Country,City).
In the viewer you can also click a column header.
Try it on Northwind.
$top and $skip — paging
$top=10&$skip=20 returns rows 21 to 30. Many services also page on their own and add a next link
(@odata.nextLink in V4, __next in V2); the viewer follows it with Next ›.
Try it.
$expand — related entities in one request
$expand=Category embeds the navigation property's target. V4 allows nested options:
$expand=Orders($select=OrderID;$top=3). In V2, nested paths use a slash: $expand=Orders/Order_Details.
Try it on Northwind.
$count — how many
V4: $count=true adds @odata.count to the answer. V2: $inlinecount=allpages. The viewer requests the count by
default and shows it above the table.
$search — free text (V4)
$search=blue is a free-text search whose meaning the service defines; many services do not implement it.
Building the URL by hand
The full request for the first example is
https://services.odata.org/TripPinRESTierService/People?$filter=FirstName eq 'Scott'&$count=true
Spaces and quotes must be percent-encoded when you paste it into code; the viewer's Copy as menu does that for curl, JavaScript, C#, Python and Power Query.
Open the TripPin data explorer
Questions
Why does $count not work on my V2 service?
OData V2 has no $count=true. Use $inlinecount=allpages to get the total next to the rows, or /EntitySet/$count for the number alone. The viewer picks the right one from the service's version.
Are query options case-sensitive?
The option names ($filter, $top) are lower case in the specification; V4.01 services may accept other casings, older ones often do not. Property names are always case-sensitive.