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 name | Parameter type | Whether is array | Required or optional | Example | Description |
|---|---|---|---|---|---|
| product_id | String | N | Y | 365165158511515 | The ID of product. |
| limit | String | N | N | 10 | An integer from 1 to 20. If not provided or invalid, it defaults to 20. |
| intent | String | N | N | related | Recommendation intents for generating product recommendations.
|
Response information
Response body:
| Parameter name | Parameter name | Parameter name | Parameter type | Whether is array | Example | Description |
|---|---|---|---|---|---|---|
| message | String | No | ||||
| description | String | No | ||||
| products | Object | This is an array of products. | ||||
| id | String | No | This is the product ID. | |||
| title | String | No | This is the product title. | |||
| handle | String | No | This is the product handle. | |||
| url | String | No | This is the product's relative path, formatted as /products/handle. | |||
| description | String | No | This is the product description. | |||
| brand | String | No | This is the brand name. | |||
| tags | List<String> | No | This is an array of product tags. | |||
| images | List<String> | No | This is an array of product main images. | |||
| featured_image | String | No | This is the product's featured image, the same as images[0]. | |||
| medias | Object | |||||
| resource | String | No | This is the resource location in URL format. | |||
| cover | String | No | This is the cover image location in URL format. | |||
| type | String | No | This is the media resource type. | |||
| alt | String | No | These are words or phrases describing the image feature or content. | |||
| sold_out | Boolean | No | This indicates whether the product is sold out. | |||
| price | Long | No | This is the product price. | |||
| price_min | Long | No | This is the minimum product price. | |||
| price_max | Long | No | This is the maximum product price. | |||
| price_varies | Boolean | No | This indicates whether the minimum and maximum prices of product variants are the same. | |||
| compare_at_price | Long | No | This is the original price of the variant, the same as compareAtPriceMin. | |||
| compare_at_price_min | Long | No | This is the minimum original price of the variant. | |||
| compare_at_price_max | Long | No | This is the maximum original price of the variant. | |||
| compare_at_price_varies | Boolean | No | This indicates whether the minimum and maximum original prices of product variants are the same. | |||
| created_at | Date | No | This is the product creation time. | |||
| published_at | Date | No | This is the product publish time. | |||
| options | Object | This is an array of options. | ||||
| name | String | No | This is the option name. | |||
| values | List<String> | No | These are the option values. | |||
| values_images | Map<String,String> | No | This is a mapping dictionary of option values and option value images. | |||
| variants | Object | This is an array of variants. | ||||
| id | String | No | This is the variant ID. | |||
| barcode | String | No | This is the barcode. | |||
| title | String | No | This is the variant title. | |||
| option1 | String | No | This is the first option value of the variant. | |||
| option2 | String | No | This is the second option value of the variant. | |||
| option3 | String | No | This is the third option value of the variant. | |||
| option4 | String | No | This is the fourth option value of the variant. | |||
| option5 | String | No | This is the fifth option value of the variant. | |||
| sku | String | No | This is the variant SKU. | |||
| featured_image | String | No | This is the variant image. | |||
| name | String | No | This is the variant name, formatted as Product title · Variant title. | |||
| public_title | String | No | This is the public title, the same as variant.title. | |||
| options | List<String> | No | These are the variant options array. | |||
| weight | BigDecimal | No | This is the weight. | |||
| weight_unit | String | No | This is the weight unit. | |||
| price | Long | No | This is the variant price, in the smallest currency unit. | |||
| compare_at_price | Long | No | This is the variant original price, in the smallest currency unit. | |||
| inventory_policy | String | No | This indicates whether overselling is allowed, continue: allowed, deny: not allowed. | |||
| inventory_tracker | Boolean | No | This 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?