Product Recommendations

You can query the Ajax API through the associated product to obtain the product details related to the incoming product content

Request information

API Path:

GET https://{handle}.myshopline.com/api/product/recommendations/products.json

Request query:

Parameter nameParameter typeWhether is arrayRequired or optionalExampleDescription
product_idStringNY365165158511515The ID of product.
limitStringNN10An integer from 1 to 20. If not provided or invalid, it defaults to 20.
intentStringNNrelated

Recommendation intents for generating product recommendations.

  • related: Products that are similar to the input product in terms of their own attributes, such as sports shoes and leather shoes.
  • complementary: Products that can be used in combination with the input product based on their product attributes, such as leather shoes and shoe polish.

Response information

Response body:

Parameter nameParameter nameParameter nameParameter typeWhether is arrayExampleDescription
messageStringNo
descriptionStringNo
productsObjectThis is an array of products.
idStringNoThis is the product ID.
titleStringNoThis is the product title.
handleStringNoThis is the product handle.
urlStringNoThis is the product's relative path, formatted as /products/handle.
descriptionStringNoThis is the product description.
brandStringNoThis is the brand name.
tagsList<String>NoThis is an array of product tags.
imagesList<String>NoThis is an array of product main images.
featured_imageStringNoThis is the product's featured image, the same as images[0].
mediasObject
resourceStringNoThis is the resource location in URL format.
coverStringNoThis is the cover image location in URL format.
typeStringNoThis is the media resource type.
altStringNoThese are words or phrases describing the image feature or content.
sold_outBooleanNoThis indicates whether the product is sold out.
priceLongNoThis is the product price.
price_minLongNoThis is the minimum product price.
price_maxLongNoThis is the maximum product price.
price_variesBooleanNoThis indicates whether the minimum and maximum prices of product variants are the same.
compare_at_priceLongNoThis is the original price of the variant, the same as compareAtPriceMin.
compare_at_price_minLongNoThis is the minimum original price of the variant.
compare_at_price_maxLongNoThis is the maximum original price of the variant.
compare_at_price_variesBooleanNoThis indicates whether the minimum and maximum original prices of product variants are the same.
created_atDateNoThis is the product creation time.
published_atDateNoThis is the product publish time.
optionsObjectThis is an array of options.
nameStringNoThis is the option name.
valuesList<String>NoThese are the option values.
values_imagesMap<String,String>NoThis is a mapping dictionary of option values and option value images.
variantsObjectThis is an array of variants.
idStringNoThis is the variant ID.
barcodeStringNoThis is the barcode.
titleStringNoThis is the variant title.
option1StringNoThis is the first option value of the variant.
option2StringNoThis is the second option value of the variant.
option3StringNoThis is the third option value of the variant.
option4StringNoThis is the fourth option value of the variant.
option5StringNoThis is the fifth option value of the variant.
skuStringNoThis is the variant SKU.
featured_imageStringNoThis is the variant image.
nameStringNoThis is the variant name, formatted as Product title · Variant title.
public_titleStringNoThis is the public title, the same as variant.title.
optionsList<String>NoThese are the variant options array.
weightBigDecimalNoThis is the weight.
weight_unitStringNoThis is the weight unit.
priceLongNoThis is the variant price, in the smallest currency unit.
compare_at_priceLongNoThis is the variant original price, in the smallest currency unit.
inventory_policyStringNoThis indicates whether overselling is allowed, continue: allowed, deny: not allowed.
inventory_trackerBooleanNoThis indicates whether to track inventory, default is false.

Scenario 1: Get a product similar to the Requested product

Request

fetch("https://linxiaofa14.myshoplinedev.com/api/product/recommendations/products.json?product_id=1515707502717517&limit=2")

response

{
"products": [
{
"id": "16050982612893754143333867",
"title": "Fashion Women Dresses Summer Boho Dot Print High Waist Shirt Dress",
"handle": "fashion-women-dresses-summer-boho-dot-print-high-waist-shirt-dress",
"url": "https://img.myshopline.com/image/official/e46e6189dd5641a3b179444cacdcdd2a.png",
"description": "",
"brand": "aliexpress",
"images": [
"https://img.myshopline.com/image/official/e46e6189dd5641a3b179444cacdcdd2a.png"
],
"price": 2499,
"options": [
{
"name": "Size",
"values": [
"S",
"M",
"L",
"XL"
],
"values_images": {
"S": "",
"L": "",
"XL": "",
"M": ""
}
},
{
"name": "Color",
"values": [
"Green",
"Black",
"Navy blue",
"Orange",
"White",
"Yellow"
],
"values_images": {
"Navy blue": "",
"White": "",
"Yellow": "",
"Black": "",
"Orange": "",
"Green": ""
}
}
],
"variants": [
{
"id": "18050982612895096320523867",
"title": "S · Green",
"option1": "S",
"option2": "Green",
"name": "Fashion Women Dresses Summer Boho Dot Print High Waist Shirt Dress · S · Green",
"options": [
"S",
"Green"
],
"price": 2499,
"featured_image": "https://img.myshopline.com/image/official/e46e6189dd5641a3b179444cacdcdd2a.png",
"public_title": "S · Green",
"compare_at_price": 2799,
"inventory_policy": "deny",
"inventory_tracker": false
}
],
"medias": [
{
"resource": "https://img.myshopline.com/image/official/e46e6189dd5641a3b179444cacdcdd2a.png",
"type": "IMAGE"
}
],
"sold_out": false,
"price_min": 2499,
"price_max": 2499,
"price_varies": true,
"compare_at_price": 2799,
"compare_at_price_min": 2799,
"compare_at_price_max": 2799,
"compare_at_price_varies": true,
"created_at": "2021-10-14T18:42:42.172+0800",
"published_at": "2022-06-10T17:16:06.225+0800"
},
{
"id": "16050982612893754143333867",
"title": "Fashion Women Dresses Summer Boho Dot Print High Waist Shirt Dress",
"handle": "fashion-women-dresses-summer-boho-dot-print-high-waist-shirt-dress",
"url": "https://img.myshopline.com/image/official/e46e6189dd5641a3b179444cacdcdd2a.png",
"description": "",
"brand": "aliexpress",
"images": [
"https://img.myshopline.com/image/official/e46e6189dd5641a3b179444cacdcdd2a.png"
],
"price": 2499,
"options": [
{
"name": "Size",
"values": [
"S",
"M",
"L",
"XL"
],
"values_images": {
"S": "",
"L": "",
"XL": "",
"M": ""
}
},
{
"name": "Color",
"values": [
"Green",
"Black",
"Navy blue",
"Orange",
"White",
"Yellow"
],
"values_images": {
"Navy blue": "",
"White": "",
"Yellow": "",
"Black": "",
"Orange": "",
"Green": ""
}
}
],
"variants": [
{
"id": "18050982612895096320523867",
"title": "S · Green",
"option1": "S",
"option2": "Green",
"name": "Fashion Women Dresses Summer Boho Dot Print High Waist Shirt Dress · S · Green",
"options": [
"S",
"Green"
],
"price": 2499,
"featured_image": "https://img.myshopline.com/image/official/e46e6189dd5641a3b179444cacdcdd2a.png",
"public_title": "S · Green",
"compare_at_price": 2799,
"inventory_policy": "deny",
"inventory_tracker": false
}
],
"medias": [
{
"resource": "https://img.myshopline.com/image/official/e46e6189dd5641a3b179444cacdcdd2a.png",
"type": "IMAGE"
}
],
"sold_out": false,
"price_min": 2499,
"price_max": 2499,
"price_varies": true,
"compare_at_price": 2799,
"compare_at_price_min": 2799,
"compare_at_price_max": 2799,
"compare_at_price_varies": true,
"created_at": "2021-10-14T18:42:42.172+0800",
"published_at": "2022-06-10T17:16:06.225+0800"
}
]
}

Scenario 2: The product ID of the Request does not exist

Request

fetch("https://linxiaofa14.myshoplinedev.com/api/product/recommendations/products.json ?product_id=unrealproducthandle&limit=2")

response

{
"message": "Not found",
"description": "No product with id unrealproducthandle is published in the online store."
}
Was this article helpful to you?