• Pages
  • /
  • Dealers
  • /
  • Data Depot
  • /
  • Version 4
  • /
  • API
  • /
  • Services
  • /
  • Filters

Filters

Filters give the ability to narrow down the results of a request to specific subset of data based on properties of the service.

The parameter syntax structure is: ?filter[field][operator]=value.

Operators
[eq] Equal*
[ne] Not equal
[lt] Less than
[lte] or [le] Less than or equal to
[gt] Greater than
[gte] or [ge] Greater than or equal to
[pre] Prefix / Starts with

* Default behavior if an operator is not sent.

The [field] and value will depend on the endpoint and what you are trying to filter. The easiest way to explain Filters is to just give examples.

Examples

Items

In this example, only Items with a [brand_id] of 135 (FLY Racing) would be returned. As you can see, the operator has not been specified, so [eq] is assumed.

http://api.wps-inc.com/items?filter[brand_id]=135

In this next example, only Items with a [list_price] of [lt] (less than) 200 dollars would be returned.

http://api.wps-inc.com/items?filter[list_price][lt]=200

You can also combine multiple filters to produce even more powerful queries.

In this example, only Items with a [list_price] of [gt] (greater than) 200 dollars and [lt] (less than) 400 dollars would be returned.

http://api.wps-inc.com/items?filter[list_price][gt]=200&filter[list_price][lt]=400

In this example, only Items with a [sku] that are [pre] (prefixed with) 87-4 would be returned.

http://api.wps-inc.com/items?filter[sku][pre]=87-4

Products

In this example, only Products with a [name] that are [pre] (prefixed with) GM5 would be returned.

http://api.wps-inc.com/products?filter[name][pre]=GM5

You can also filter the associations of a Product.

In this example, only a Products associated Tags with a [name] that are [pre] (prefixed with) Popu would be returned. Since the following request ultimately returns Tags, what we are filtering is the Tags.

http://api.wps-inc.com/products/208016/tags?filter[name][pre]=Popu