Product Information Management System Filters
The Product Information Management System(PIMS) filters are a complex set of filters used to query for specific data in the PIMS.
Usage
Filters are structured as arrays of nested objects. This allows them to be as powerful as possible. For the full documentation please refer to our GraphQL filters or the REST filters. An example of a numericRange filter is below. You can put as many filters into the array as you would like.
[
{
"field": "weight",
"fieldId": null,
"type": {
"range": {
"numericRange": {
"from": 1,
"to": 10
}
},
}
}
]
REST Usage
In rest, we wanted to maintain the use of a GET method. To make this possible, the query string parameters are indexed for any given filter. The filter parameters are in a similar format as query parameter families, as defined by JSON API. The only caveat is that we require array indexes to make sure there are no issues parsing the parameters. To define the query parameters to match the above filters, it would look like this:
/categories?filters[][field]=weight&filters[][type][range][numeric_range][to]=10&filters[][type][range][numeric_range][from]=1
Field vs Field ID
For most queries you will be using field and not field_id. Field represents the object property you want to filter by. The name of the field must match the same value as in the response.
When you want to query against an attribute or category properties, you will need to set field to attribute or category. In this case, field_id is required and will need to be a slug for the property you want to query on for the attribute or category.
Type
Type represents the type of filtering you want to apply to the specified field. This allows us to have strongly typed parameters and to apply the appropriate filtering to any given field. The allowed values are: boolean, list, range, and value.
List Type
The list type is a unique filter. It applies a filter against a list type attribute in the PIMS. The best way to think about a list is that they act like a multi-select. They essentially have a list of possible values that can be set. The mode parameter for the list filter determines whether you want any result where the field matches all the provided values, but they could have additional values. The all mode requires the field to have all of the provided values and nothing more.