Complementary to Viewed
Use Cases
When a customer (subject) views (action) a t-shirt (noun), this endpoint can be used to retrieve information related to that information.
How the /products/viewed-related Endpoint Works¶
If you have used the analytics-2.0/event endpoint to submit data when a customer has viewed certain products, then this endpoint will return data related to that data.
Note: The UUID should match the data previously sent to the analytics-2.0/event endpoint.
Query Parameters¶
shopify_customer_id· string- Shopify Customer ID. If this value is not provided, then uuid needs to be provided. At least one of these two is required.
uuid· string- The 'Universally Unique Identifier' of the subject - the client is responsible for creating the token that represents the session. Example value: be6f5fab-32a4-43e5-967c-68017baa3aa5
subject· string- The subject of the event. Example value: user
verb· string- The action of the subject of the event. Example value: viewed
metafields· string- Valid values: yes. Returns product objects enriched with a metafields property.
limit· string · Default:5- Used to limit the number of returned results.
format· string- Valid values: pretty. Use pretty to make the response easy to read.
country_code· string-
The ISO 3166-1 alpha-2 country code (e.g.,
US,CA,GB) corresponding to a Market region. Retrieves variant pricing from the Market’s catalog. The prices returned reflect the shop’s first active Market that matches the providedcountry_code. Only products included in that Market’s catalog will be returned in the response — products excluded from the catalog will not appear.Required Shopify Scope:
read_marketsReplaces the deprecated
presentment_pricesquery parameter.
Code Example¶
// GET https://rebuyengine.com/api/v1/products/viewed-related
const params = new URLSearchParams({
shopify_customer_id: "YOUR_VALUE",
uuid: "YOUR_VALUE"
});
fetch(`https://rebuyengine.com/api/v1/products/viewed-related?${params}`)
.then(response => response.json())
.then(data => console.log(data));
Response Examples¶
200 -¶
{
"data": [
{
"id": 562396463140,
"title": "Tri-Blend Full Zip T Hoodie",
"body_html": "Tri-Blend Full Zip T Hoodie",
"vendor": "Example Brand",
"product_type": "",
"created_at": "2018-03-20T14:09:51-04:00",
"handle": "anvil-tri-blend-full-zip-t-shirt-hoodie",
"updated_at": "2021-01-04T13:45:02-05:00",
"published_at": "2018-03-20T14:08:11-04:00",
"template_suffix": null,
"published_scope": "web",
"tags": "clothing",
"admin_graphql_api_id": "gid://shopify/Product/562396463140",
"variants": [
{
"id": 7162489372708,
"product_id": 562396463140,
"title": "Black",
"price": "36.00",
"sku": "ATBFZTSH-1",
"position": 1,
"inventory_policy": "deny",
"compare_at_price": null,
"fulfillment_service": "manual",
"inventory_management": null,
"option1": "Black",
"option2": null,
"option3": null,
"created_at": "2018-03-20T14:09:51-04:00",
"updated_at": "2021-01-04T13:42:55-05:00",
"taxable": true,
"barcode": "",
"grams": 0,
"image_id": 2155921604644,
"weight": 0,
"weight_unit": "lb",
"inventory_item_id": 7159711072292,
"inventory_quantity": -11,
"old_inventory_quantity": -11,
"requires_shipping": true,
"admin_graphql_api_id": "gid://shopify/ProductVariant/7162489372708"
},
{
"id": 7162489405476,
"product_id": 562396463140,
"title": "Red",
"price": "36.00",
"sku": "ATBFZTSH-2",
"position": 2,
"inventory_policy": "deny",
"compare_at_price": null,
"fulfillment_service": "manual",
"inventory_management": null,
"option1": "Red",
"option2": null,
"option3": null,
"created_at": "2018-03-20T14:09:51-04:00",
"updated_at": "2020-05-01T14:43:57-04:00",
"taxable": true,
"barcode": "",
"grams": 0,
"image_id": 2155922227236,
"weight": 0,
"weight_unit": "lb",
"inventory_item_id": 7159711105060,
"inventory_quantity": -5,
"old_inventory_quantity": -5,
"requires_shipping": true,
"admin_graphql_api_id": "gid://shopify/ProductVariant/7162489405476"
}
],
"options": [
{
"id": 833036419108,
"product_id": 562396463140,
"name": "Color",
"position": 1,
"values": [
"Black",
"Red"
]
}
],
"images": [
{
"id": 2155921604644,
"product_id": 562396463140,
"position": 1,
"created_at": "2018-03-20T14:09:55-04:00",
"updated_at": "2019-11-15T23:59:45-05:00",
"alt": null,
"width": 1528,
"height": 1528,
"src": "https://cdn.shopify.com/s/files/1/0011/0746/0132/products/Anvil_Tri-Blend_Full_Zip_T-shirt_Hoodie-black-A.png?v=1573880385",
"variant_ids": [
7162489372708
],
"admin_graphql_api_id": "gid://shopify/ProductImage/2155921604644"
},
{
"id": 2155921801252,
"product_id": 562396463140,
"position": 2,
"created_at": "2018-03-20T14:09:58-04:00",
"updated_at": "2019-11-15T23:59:45-05:00",
"alt": null,
"width": 1528,
"height": 1528,
"src": "https://cdn.shopify.com/s/files/1/0011/0746/0132/products/Anvil_Tri-Blend_Full_Zip_T-shirt_Hoodie-black-B.png?v=1573880385",
"variant_ids": [],
"admin_graphql_api_id": "gid://shopify/ProductImage/2155921801252"
},
{
"id": 2155922227236,
"product_id": 562396463140,
"position": 3,
"created_at": "2018-03-20T14:10:02-04:00",
"updated_at": "2019-11-15T23:59:45-05:00",
"alt": null,
"width": 1528,
"height": 1528,
"src": "https://cdn.shopify.com/s/files/1/0011/0746/0132/products/Anvil_Tri-Blend_Full_Zip_T-shirt_Hoodie-red-A.png?v=1573880385",
"variant_ids": [
7162489405476
],
"admin_graphql_api_id": "gid://shopify/ProductImage/2155922227236"
},
{
"id": 2155922620452,
"product_id": 562396463140,
"position": 4,
"created_at": "2018-03-20T14:10:05-04:00",
"updated_at": "2019-11-15T23:59:45-05:00",
"alt": null,
"width": 1528,
"height": 1528,
"src": "https://cdn.shopify.com/s/files/1/0011/0746/0132/products/Anvil_Tri-Blend_Full_Zip_T-shirt_Hoodie-red-B.png?v=1573880385",
"variant_ids": [],
"admin_graphql_api_id": "gid://shopify/ProductImage/2155922620452"
}
],
"image": {
"id": 2155921604644,
"product_id": 562396463140,
"position": 1,
"created_at": "2018-03-20T14:09:55-04:00",
"updated_at": "2019-11-15T23:59:45-05:00",
"alt": null,
"width": 1528,
"height": 1528,
"src": "https://cdn.shopify.com/s/files/1/0011/0746/0132/products/Anvil_Tri-Blend_Full_Zip_T-shirt_Hoodie-black-A.png?v=1573880385",
"variant_ids": [
7162489372708
],
"admin_graphql_api_id": "gid://shopify/ProductImage/2155921604644"
}
},
{
"id": 4484976148516,
"title": "Reversible Beanie",
"body_html": "Classic Beanie",
"vendor": "Example Brand",
"product_type": "Beanie",
"created_at": "2020-01-28T16:24:50-05:00",
"handle": "beanie-reversible",
"updated_at": "2020-12-17T15:09:30-05:00",
"published_at": "2020-01-28T16:24:50-05:00",
"template_suffix": "",
"published_scope": "web",
"tags": "clothing",
"admin_graphql_api_id": "gid://shopify/Product/4484976148516",
"variants": [
{
"id": 31628220530724,
"product_id": 4484976148516,
"title": "Default Title",
"price": "24.00",
"sku": "BEANIE1",
"position": 1,
"inventory_policy": "deny",
"compare_at_price": null,
"fulfillment_service": "manual",
"inventory_management": "shopify",
"option1": "Default Title",
"option2": null,
"option3": null,
"created_at": "2020-01-28T16:24:50-05:00",
"updated_at": "2020-12-17T15:09:30-05:00",
"taxable": true,
"barcode": "",
"grams": 0,
"image_id": null,
"weight": 0,
"weight_unit": "lb",
"inventory_item_id": 33399558504484,
"inventory_quantity": 100,
"old_inventory_quantity": 100,
"requires_shipping": true,
"admin_graphql_api_id": "gid://shopify/ProductVariant/31628220530724"
}
],
"options": [
{
"id": 5868992036900,
"product_id": 4484976148516,
"name": "Title",
"position": 1,
"values": [
"Default Title"
]
}
],
"images": [
{
"id": 14057553854500,
"product_id": 4484976148516,
"position": 1,
"created_at": "2020-01-28T16:25:05-05:00",
"updated_at": "2020-01-28T16:25:05-05:00",
"alt": null,
"width": 600,
"height": 600,
"src": "https://cdn.shopify.com/s/files/1/0011/0746/0132/products/reversible-beanie.jpg?v=1580246705",
"variant_ids": [],
"admin_graphql_api_id": "gid://shopify/ProductImage/14057553854500"
}
],
"image": {
"id": 14057553854500,
"product_id": 4484976148516,
"position": 1,
"created_at": "2020-01-28T16:25:05-05:00",
"updated_at": "2020-01-28T16:25:05-05:00",
"alt": null,
"width": 600,
"height": 600,
"src": "https://cdn.shopify.com/s/files/1/0011/0746/0132/products/reversible-beanie.jpg?v=1580246705",
"variant_ids": [],
"admin_graphql_api_id": "gid://shopify/ProductImage/14057553854500"
}
},
{
"id": 562402787364,
"title": "Dyenomite 100 Cotton Rainbow Tie-Dye T",
"body_html": "Dyenomite 100 Cotton Rainbow Tie-Dye T",
"vendor": "Example Brand",
"product_type": "",
"created_at": "2018-03-20T14:14:53-04:00",
"handle": "dyenomite-100-cotton-rainbow-tie-dye-t-shirt",
"updated_at": "2021-01-04T15:26:25-05:00",
"published_at": "2021-01-04T12:28:38-05:00",
"template_suffix": "",
"published_scope": "web",
"tags": "clothing",
"admin_graphql_api_id": "gid://shopify/Product/562402787364",
"variants": [
{
"id": 7162520731684,
"product_id": 562402787364,
"title": "Tie-Dye",
"price": "10.00",
"sku": "DCRTDTS",
"position": 1,
"inventory_policy": "deny",
"compare_at_price": null,
"fulfillment_service": "manual",
"inventory_management": "shopify",
"option1": "Tie-Dye",
"option2": null,
"option3": null,
"created_at": "2018-03-20T14:14:53-04:00",
"updated_at": "2021-01-04T15:26:25-05:00",
"taxable": true,
"barcode": "",
"grams": 0,
"image_id": 2155950080036,
"weight": 0,
"weight_unit": "lb",
"inventory_item_id": 7159743873060,
"inventory_quantity": 1000,
"old_inventory_quantity": 1000,
"requires_shipping": true,
"admin_graphql_api_id": "gid://shopify/ProductVariant/7162520731684"
}
],
"options": [
{
"id": 833044185124,
"product_id": 562402787364,
"name": "Color",
"position": 1,
"values": [
"Tie-Dye"
]
}
],
"images": [
{
"id": 2155950080036,
"product_id": 562402787364,
"position": 1,
"created_at": "2018-03-20T14:14:58-04:00",
"updated_at": "2019-11-15T23:59:46-05:00",
"alt": null,
"width": 1528,
"height": 1528,
"src": "https://cdn.shopify.com/s/files/1/0011/0746/0132/products/Dyenomite_100__Cotton_Rainbow_Tie-Dye_T-shirt-A.png?v=1573880386",
"variant_ids": [
7162520731684
],
"admin_graphql_api_id": "gid://shopify/ProductImage/2155950080036"
},
{
"id": 2155950702628,
"product_id": 562402787364,
"position": 2,
"created_at": "2018-03-20T14:15:06-04:00",
"updated_at": "2019-11-15T23:59:46-05:00",
"alt": null,
"width": 1528,
"height": 1528,
"src": "https://cdn.shopify.com/s/files/1/0011/0746/0132/products/Dyenomite_100__Cotton_Rainbow_Tie-Dye_T-shirt-B.png?v=1573880386",
"variant_ids": [],
"admin_graphql_api_id": "gid://shopify/ProductImage/2155950702628"
}
],
"image": {
"id": 2155950080036,
"product_id": 562402787364,
"position": 1,
"created_at": "2018-03-20T14:14:58-04:00",
"updated_at": "2019-11-15T23:59:46-05:00",
"alt": null,
"width": 1528,
"height": 1528,
"src": "https://cdn.shopify.com/s/files/1/0011/0746/0132/products/Dyenomite_100__Cotton_Rainbow_Tie-Dye_T-shirt-A.png?v=1573880386",
"variant_ids": [
7162520731684
],
"admin_graphql_api_id": "gid://shopify/ProductImage/2155950080036"
}
}
]
}