• Pages
  • /
  • Dealers
  • /
  • Data Depot
  • /
  • Version 4
  • /
  • API
  • /
  • Helpers
  • /
  • Filtering Includes

Filtering Includes

Much like standard filters, filtering includes gives you the ability to narrow down the results of a request to specific subset of data. The difference is what you are operating on. The includes themselves are the part of the response that is being filtered, not the primary service.

For example, when you make a request like /products?include=items:filter(brand_id|135), what you are actually saying is: Give me all Products, and include their Items, but only return those included Items that are of Brand 135 (FLY Racing). You are still going to get all Products, that part doesn't change, the only part of the response that changes is the included Items will be filtered down to FLY Racing Items.

The parameter syntax structure is: ?include=service:filter(field|value|operator).

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.

Examples

In this example, all the Products along with their included Items would be returned. However, the included Items would be filtered down to only the Items that have a list_price of lt (less than) 200 dollars.

https://api.wps-inc.com/products?include=items:filter(list_price|200|lt)

In this example, all the Products along with their included Items would be returned. However, the included Items would be filtered down to only the Items that have a sku that are pre (prefixed with) 87-40.

https://api.wps-inc.com/products?include=items:filter(sku|87-40|pre)