OCAPI filtering 23.2
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/v23_2/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" : "23.2",
...
"product_links":
[{
"source_product_id":"123",
"source_product_link":"http://example.com/dw/shop/v23_2/product/123",
"target_product_id":"456",
"target_product_link":"http://example.com/dw/shop/v23_2/product/456",
"type":"cross_sell",
"direction":"out"
},
{
"source_product_id":"123",
"source_product_link":"http://example.com/dw/shop/v23_2/product/123",
"target_product_id":"789",
"target_product_link":"http://example.com/dw/shop/v23_2/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.