Filtering and sorting

Learn how to use URL parameters to filter and sort results from the PandaScore REST API.

PandaScore allows to filter and sort the results of requests by adding query parameters to the request URL.

Filter

The filter query parameter is used to check for strict equality. Using the filter[field]=value syntax, you can filter out results where field is not strictly equal to value.

To get only LoL champions whose name is Brand, use the following URL:

/lol/champions?filter[name]=Brand

The filter parameter also accepts a list of comma-separated values. To get only LoL champions whose name is either Brand or Twitch, use the following URL:

/lol/champions?filter[name]=Brand,Twitter

📘

Info

When using filter with dates, dates should be given in UTC time.

🚧

Warning

The filter parameter only allows to filter dates on their date (day, month, year). The time (hours, minutes, seconds) is ignored.

Search

The search query parameter is used to check for string values that contains a given sub-string. Using the search[field]=value, you can filter out results where field does not contain value.

To get only LoL champions whose name contains "twi", use the following URL:

/lol/champions?search[name]=twi

📘

Info

The search query parameter only works with string values.

Range

The range query parameter is used to check for numeric values that are between a given interval. Using the range[field]=0,100, you can filter out results where field is not between 0 and 100.

To get only LoL champions whose HP are between 500 and 100, use the following URL:

/lol/champions?range[hp]=500,1000

📘

Info

The range query parameter only works with numeric values.

Sort

The sort query parameter is used to sort results based on fields values. Using the sort=field syntax, you can sort results by field.

The sorting is always done in ascending order unless the field name is prefixed with a minus, in which case the order is descending.

It is possible to sort by multiple fields by providing a comma-separated list of values. In that case, the sorting is done by the first field, then the second, and so on.

The following URL allows you to:

  • get all LoL champions
  • sort champions by attack damage
  • sort champions with the same attack damage by their name (descending alphabetical order).
/lol/champions?sort=attackdamage,-name

Did this page help you?