OCAPI filtering 21.3

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/v21_3/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" : "21.3",
  ...
  "product_links":
  [{
    "source_product_id":"123",
    "source_product_link":"http://example.com/dw/shop/v21_3/product/123",
    "target_product_id":"456",
    "target_product_link":"http://example.com/dw/shop/v21_3/product/456",
    "type":"cross_sell",
    "direction":"out"
  },
  {
    "source_product_id":"123",
    "source_product_link":"http://example.com/dw/shop/v21_3/product/123",
    "target_product_id":"789",
    "target_product_link":"http://example.com/dw/shop/v21_3/product/789",
    "type":"cross_sell",
    "direction":"out"
  }]
X OCAPI versions 15.x and 16.x will be retired on March 31, 2021. For dates and more information, see the OCAPI versioning and deprecation policy and this Knowledge Article.
X Privacy Update: We use cookies to make interactions with our websites and services easy and meaningful, to better understand how they are used. By continuing to use this site you are giving us your consent to do this. Privacy Policy.