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 nameParameter typeWhether is arrayRequired or optionalExampleDescription
handleStringNYproduct-handleThe handle of the product.

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.

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?