Odata Query - Saba-sports/OddsDirectAPI GitHub Wiki
A query is part of a URL that is used to request specific data.
We use OData query format (not protocol) with some limitations and enhancements, as described below.
The OData query format represents a composition of several standard and custom query options. Usually you will work with: $filter, $orderby, $top, $skip query options.
API support odata options
Parameter |
Description |
Example |
$filter |
Allows filtering a collection of resources that are addressed by a request URL |
$filter=sporttype eq 1 |
$orderby |
Allows requesting resources in either ascending or descending order - ASC: the data from smallest to largest - DESC: the data from largest to smallest |
$orderby=sporttype desc |
$top |
Allows requesting a specific number of top results to be included in the result $top can only be less than 50 |
$top=50 |
$skip |
Allows requesting a number of items to be skipped and not included in the result |
$skip=50 |
& |
Allows combining the options in a query |
$filter=sporttype eq 1&$top=50 |
Support odata options
Parameter |
Description |
Example |
eq |
Equal |
$filter=sporttype eq 1 |
ne |
Not equal |
$filter=sporttype ne 2 |
lt |
Less than |
$filter=bettype lt 20 |
le |
Less than or equal |
$filter=bettype le 20 |
gt |
Greater than |
$filter=bettype gt 20 |
ge |
Greater than or equal |
$filter=bettype ge 20 |
in |
in |
$filter=sporttype in (1,2) |
or |
Logical or |
$filter=sporttype eq 1 or sporttype eq 2 |
and |
Logical and |
$filter=sporttype eq 1 and isparlay eq true |
contains |
contain something |
1. Basic usage: $filter=contains(leagueName,'NBA'), filter language type by ?language 2. When you want to filter specific keywords, you should use eq false. e.g. $filter=contains(leaguename, 'NBA') eq false3. If you need to filter the "name" field and the language type is different from ?language , you can use "/" to switch the language typee.g. ?query=$filter=contains(leaguename/en, 'NBA') eq false&language=cs |
Support odata functions
Parameter |
Description |
Example |
toupper |
Convert string to its uppercase equivalent |
$filter=contains(toupper(leagueName/en), toupper('nba'))support for string type field, If need to filter "name" filed, must use "/" to switch language type |
tolower |
Convert string to its lowercase equivalent |
$filter=contains(tolower(leagueName/en), tolower('nba'))support for string type field, If need to filter "name" filed, must use "/" to switch language type |