Frequently bought together products
How to use the Metrics API to get the products that have been most frequently bought together with other ones
The problem
The solution
Filter
Attribute
Operator
Example
curl -g -X POST \
'https://{{your_domain}}.commercelayer.io/metrics/analysis/fbt' \
-H 'Accept: application/vnd.api.v1+json' \
-H 'Content-Type: application/vnd.api+json' \
-H 'Authorization: Bearer {{your_access_token}}' \
-d '{
"filter": {
"line_items": {
"item_ids": {
"in": [ "BmDzSVkXAW", "ZrxeSRgOmB" ]
}
}
}
}'{
"data": [
{
"item_id": "nprzSARKeW",
"value": 103,
"type": "skus",
"name": "Black T-Shirt, Men, Size L"
},
{
"item_id": "ZNRJSQXkjZ",
"value": 99,
"type": "skus",
"name": "Pink T-Shirt, Women, Size XXS"
},
{
"item_id": "BxAkSrDODn",
"value": 41,
"type": "skus",
"name": "Pink Short Pants, Women, Size XS"
},
{ ... }
],
"meta": {
"type": "fbt",
"trace_id": "fe571ea2-8a4f-4a5e-bd26-ac54651bb2e4",
"mode": "test",
"organization_id": "xYZkjABcde",
"market_ids": [ "yzXKjYzaCx", "..." ]
}
}Last updated