Appearance
Filtering & sorting
Resources filtering and sorting
The following resources can be filtered according to the specified list of available query parameters. If an invalid parameter is supplied, a 422 response code is returned.
List of supported resources for filtering/sorting:
ticketseventstournamentsteams
Default comparison is equal (=).
Additional resource filtering
Supported operators. Syntax is: query_parameter=operator:value
| Comparison Operators | Description | Example |
|---|---|---|
| lt | Less than | /v1/tickets?stock=lt:5 |
| gt | Greater than | /v1/tickets?sales_price=gt:5000 |
| le | Less than or equal | /v1/tickets?stock=le:5 |
| ge | Greater than or equal | /v1/tickets?stock=ge:5 |
| eq | Equal | /v1/teams?sport_type=eq:soccer |
| is_null | Is null | /v1/events?venue_id=is_null |
| is_not_null | Is not empty value (if applicable) | /v1/events?venue_id=is_not_null |
| like | Case sensitive like (if applicable) | /v1/teams?team_name=like:Ajax% |
| ilike | Case insensitive ilike | /v1/teams?team_name=ilike:ajax% |
| in | Values in set of 1,2,3 | /v1/teams?sport_type=in:[soccer,rugby] |
| not_in | Values not in | /v1/teams?sport_type=not_in:[soccer,rugby] |
If no comparison operator is supplied, the equal comparison is applied.
Examples
/tickets?sales_price=gt:5000: Filter the ticket resources on sales price > 50 euro (or local currency)/tickets?stock=lt:5: Tickets with less than 5 items in stock/tickets?stock=lt:5&sales_price=gt:10000: Tickets with less than 5 items in stock and over 100 euro.
Use the in operator to fetch several items in one go. One filter value can be at most 2000 characters (about 50 IDs). See Best practices.
Sorting
The output can be sorted by using the query parameter sorting.
Syntax is: sorting=query_parameter:direction
Direction can be asc (ascending) or desc (descending).
You can sort on multiple fields by using a , between the sorting statements.
Examples
/tickets?sorting=sales_price:desc,stock:asc: First, the tickets will be sorted from expensive to cheap and then on availability.
Next steps
- Find events & tickets: filters in practice
- Errors & validation: what happens when a filter is invalid