Query Product
You can query the detailed information of all products allowed to be displayed on the C-side on the front-end interface through the product query Ajax API
Request information
API Path:
GET
https://{handle}.myshopline.com/api/product/products.json
Request query:
Parameter name | Parameter type | Whether is array | Required or optional | Example | Description |
---|---|---|---|---|---|
handle | String | N | Y | product-handle | The handle of the product. |
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. |
Request/response examples
Scenario 1: Query products normally
Request
fetch("https://shoplinedemo.myshopline.com/api/product/products.json?handle=loose-high-waist-sequined-wide-leg-pants-2")
response
{
"products": [
{
"id": "16054505410172913613383867",
"title": "Loose high waist sequined wide-leg pants",
"handle": "loose-high-waist-sequined-wide-leg-pants-2",
"url": "https://img.myshopline.com/image/official/e46e6189dd5641a3b179444cacdcdd2a.png",
"description": "product descritption",
"price": 1379400,
"options": [
{
"name": "Color",
"values": [
"Silver",
"White"
],
"values_images": {
"Silver": "",
"White": ""
}
},
{
"name": "Size",
"values": [
"S",
"M",
"L"
],
"values_images": {
"S": "",
"L": "",
"M": ""
}
}
],
"variants": [
{
"id": "18054505410177275688963867",
"barcode": "",
"title": "Silver · S",
"option1": "Silver",
"option2": "S",
"sku": "80353SilverS-96",
"name": "Loose high waist sequined wide-leg pants · Silver · S",
"options": [
"Silver",
"S"
],
"price": 1379400,
"public_title": "Silver · S",
"compare_at_price": 3298,
"inventory_policy": "deny",
"inventory_tracker": true
},
{
"id": "18054505410177275689033867",
"barcode": "",
"title": "Silver · M",
"option1": "Silver",
"option2": "M",
"sku": "80353SilverM-34",
"name": "Loose high waist sequined wide-leg pants · Silver · M",
"options": [
"Silver",
"M"
],
"price": 1379400,
"public_title": "Silver · M",
"compare_at_price": 3298,
"inventory_policy": "deny",
"inventory_tracker": true
},
{
"id": "18054505410177275689073867",
"barcode": "",
"title": "Silver · L",
"option1": "Silver",
"option2": "L",
"sku": "80353SilverL-72",
"name": "Loose high waist sequined wide-leg pants · Silver · L",
"options": [
"Silver",
"L"
],
"price": 1379400,
"public_title": "Silver · L",
"compare_at_price": 3298,
"inventory_policy": "deny",
"inventory_tracker": true
},
{
"id": "18054505410177275689113867",
"barcode": "",
"title": "White · S",
"option1": "White",
"option2": "S",
"sku": "80353WhiteS-62",
"name": "Loose high waist sequined wide-leg pants · White · S",
"options": [
"White",
"S"
],
"price": 1379400,
"public_title": "White · S",
"compare_at_price": 3298,
"inventory_policy": "deny",
"inventory_tracker": true
},
{
"id": "18054505410177275689153867",
"barcode": "",
"title": "White · M",
"option1": "White",
"option2": "M",
"sku": "80353WhiteM-46",
"name": "Loose high waist sequined wide-leg pants · White · M",
"options": [
"White",
"M"
],
"price": 1379400,
"public_title": "White · M",
"compare_at_price": 3298,
"inventory_policy": "deny",
"inventory_tracker": true
},
{
"id": "18054505410177275689183867",
"barcode": "",
"title": "White · L",
"option1": "White",
"option2": "L",
"sku": "80353WhiteL-46",
"name": "Loose high waist sequined wide-leg pants · White · L",
"options": [
"White",
"L"
],
"price": 1379400,
"public_title": "White · L",
"compare_at_price": 3298,
"inventory_policy": "deny",
"inventory_tracker": true
}
],
"medias": [],
"sold_out": true,
"price_min": 1379400,
"price_max": 1379400,
"price_varies": true,
"compare_at_price": 3298,
"compare_at_price_min": 3298,
"compare_at_price_max": 3298,
"compare_at_price_varies": true,
"created_at": "2022-06-14T19:21:10.228+0800",
"published_at": "2022-06-14T19:21:10.290+0800"
}
]
}
Scenario 2: The product handle is illegal
Request
fetch("https://shoplinedemo.myshoplinedev.com/api/product/products.json?handle=handle-that-does-not-exist")
response
{
"message": "Not found"
}
{
"message": "Not found",
"description": "No product with id unrealproducthandle is published in the online store."
}
Was this article helpful to you?