Skip to content

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:

  • tickets
  • events
  • tournaments
  • teams

Default comparison is equal (=).

Additional resource filtering ​

Supported operators. Syntax is: query_parameter=operator:value

Comparison OperatorsDescriptionExample
ltLess than/v1/tickets?stock=lt:5
gtGreater than/v1/tickets?sales_price=gt:5000
leLess than or equal/v1/tickets?stock=le:5
geGreater than or equal/v1/tickets?stock=ge:5
eqEqual/v1/teams?sport_type=eq:soccer
is_nullIs null/v1/events?venue_id=is_null
is_not_nullIs not empty value (if applicable)/v1/events?venue_id=is_not_null
likeCase sensitive like (if applicable)/v1/teams?team_name=like:Ajax%
ilikeCase insensitive ilike/v1/teams?team_name=ilike:ajax%
inValues in set of 1,2,3/v1/teams?sport_type=in:[soccer,rugby]
not_inValues 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 ​