OCAPI filtering 19.1

After you specify a resource type and relationship type (see URL schema), you can specify a filter parameter to further reduce the number of resource instances in the result set. Filter parameters differ for each resource_type and relationship_type pair. In the following example, the first filter parameter type specifies a value of cross_sell, eliminating from the result set all resource instances whose type is not equal to cross_sell. The second filter parameter direction specifies the value out, eliminating all resource instances whose direction is different.


REQUEST:
GET /dw/shop/v19_1/products/123/links?type=cross_sell&direction=out HTTP/1.1
Host: example.com
Accept: application/json

RESPONSE:
HTTP/1.1 200 OK
Content-Length: 351
Content-Type: application/json; charset=UTF-8

{
  "_v":"19.1",
  ...
  "product_links":
  [{
    "source_product_id":"123",
    "source_product_link":"http://example.com/dw/shop/v19_1/product/123",
    "target_product_id":"456",
    "target_product_link":"http://example.com/dw/shop/v19_1/product/456",
    "type":"cross_sell",
    "direction":"out"
  },
  {
    "source_product_id":"123",
    "source_product_link":"http://example.com/dw/shop/v19_1/product/123",
    "target_product_id":"789",
    "target_product_link":"http://example.com/dw/shop/v19_1/product/789",
    "type":"cross_sell",
    "direction":"out"
  }]