Search Product

You can search contents exist in store at front-end interface by searching Ajax API

Request information

API Path:

GET https://{handle}.myshopline.com/api/product/search/suggest.json

Request query:

Parameter nameParameter typeWhether is arrayRequired or optionalExampleDescription
qStringNoYesshirtThe content to search.
fieldStringNoYestitle,product_typeThe fields to be searched and operations:
- title
- product_type
- tag
- variants.sku
- brand
resource_typeStringNoYesproductThe type of result requested:
- product
- collection
- page
- article
- query
available_typeStringNoYesshowSpecifies the type of products to return, supported parameters are: show, hide.
limitStringNoNo10An integer from 1 to 30. If not provided or invalid, it defaults to 30.
limit_scopeStringNoNoeacheach: means returning the first limit records for each resource_type.
all: means returning the first limit records according to the following priority.
- query
- product
- collections
- article
- page

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.
collectionsList<Object>NoThis is an array of collections.
idStringYesThis is the collection ID.
handleStringYesThis is the collection handle.
titleStringYesThis is the collection title.
urlStringYesThis is the collection relative path, formatted as /collections/handle.
published_atStringYesThis is the time published to the online store channel.
bodyStringNoThis is the collection description.
featured_imageThis is the collection featured image.
altStringNoThese are words or phrases describing the image feature or content.
heightIntegerNoThis is the image height.
widthIntegerNoThis is the image width.
urlStringYesThis is the image location in URL format.
queriesList<Object>NoThis is an array of recommended queries.
textStringYesThis is the recommended query.
urlStringYesThis is the link to the search results page for the query.
pagesList<Object>NoThis is an array of custom pages.
idStringYesThis is the page ID.
handleStringYesThis is the page handle.
titleStringYesThis is the page title.
urlStringYesThis is the page relative path, formatted as /pages/handle.
authorStringNoThis is the page author.
bodyStringNoThis is the page content.
published_atStringNoThis is the time published to the online store channel.
articlesList<Object>NoThis is an array of blogs.
idStringYesThis is the blog ID.
handleStringYesThis is the blog handle.
titleStringNoThis is the blog title.
urlStringYesThis is the blog relative path, formatted as /blogs/handle.
summary_htmlStringNoThis is the blog summary.
published_atStringNoThis is the time published to the online store channel.
featured_imageObjectNoThis is the blog featured image.
altStringNoThese are words or phrases describing the image feature or content.
heightIntegerNoThis is the image height.
widthIntegerNoThis is the image width.
urlStringYesThis is the image location in URL format.

Request/response examples

Scenario : Search for products whose product name contains dress

Request

fetch("https://linxiaofa14.myshoplinedev.com/api/product/search/suggest.json?q=dress&field=title&resource_type=product&available_type=show&limit=1")

response

  "queries": [
{
"text": "100",
"url": "/search?keyword=100"
}
],
"products": [
{
"id": "16060168376183564632570904",
"title": "product",
"handle": "product",
"description": null,
"brand": null,
"vendor": null,
"tags": null,
"images": null,
"price": 11100,
"options": [
{
"name": "Color",
"values": [
"red",
"blue"
],
"values_images": {
"red": null,
"blue": null
}
}
],
"variants": [
{
"id": "18060168376188765569600904",
"barcode": null,
"title": "red",
"option1": "red",
"option2": null,
"option3": null,
"option4": null,
"option5": null,
"sku": null,
"name": "product · red",
"options": [
"red"
],
"weight": null,
"price": 11100,
"available": true,
"featured_image": null,
"public_title": "red",
"weight_unit": null,
"compare_at_price": 22200,
"inventory_policy": "deny",
"inventory_tracker": true,
"requires_selling_plan": false,
"selling_plan_alloactions": [

],
"featured_image_v2": null
},
{
"id": "18060168376188765569640904",
"barcode": null,
"title": "blue",
"option1": "blue",
"option2": null,
"option3": null,
"option4": null,
"option5": null,
"sku": "",
"name": "product · blue",
"options": [
"blue"
],
"weight": null,
"price": 11100,
"available": true,
"featured_image": null,
"public_title": "blue",
"weight_unit": null,
"compare_at_price": 22200,
"inventory_policy": "deny",
"inventory_tracker": true,
"requires_selling_plan": false,
"selling_plan_alloactions": [

],
"featured_image_v2": null
}
],
"visible": true,
"url": "/products/评分100.99--商品002",
"featured_image": null,
"medias": [

],
"sold_out": false,
"price_min": 11100,
"price_max": 11100,
"price_varies": true,
"compare_at_price": 22200,
"compare_at_price_min": 22200,
"compare_at_price_max": 22200,
"compare_at_price_varies": true,
"created_at": "2023-07-10T11:26:18.087+08:00",
"published_at": "2023-07-10T11:26:18.148+08:00",
"requires_selling_plan": false,
"selling_plan_groups": [

],
"featured_image_v2": null,
"custom_category_name": ""
}
],
"collections": [
{
"body": "new collections",
"handle": "new--001--1061392384",
"id": "12260161333887589518440904",
"title": "new collections",
"url": "/collections/new--001--1061392384",
"featured_image": {
"alt": "cover",
"width": 1154,
"height": 642,
"url": "https://d2n979dmt31clo.cloudfront.net/image/store/4200012610/1625907878650/d7614fad260b448a810ce7de0a524997.png?w=1154&h=642",
"aspect_ratio": null
},
"published_at": "2023-07-09T23:46:42.691+08:00"
}
],
"pages": [
{
"author": "4200012610",
"handle": "store",
"id": "5980852662048395303",
"title": "store",
"url": "/pages/store",
"published_at": "2023-06-15T15:38:00.000+08:00"
}
],
"articles": [
{
"author": "sgstore",
"handle": "news/123",
"id": "648ab1a0f301e236c33c9d69",
"title": "123",
"url": "/blogs/news/123",
"featured_image": null,
"published_at": "2023-06-15T14:37:00.000+08:00",
"summary_html": "123"
}
]
}
Was this article helpful to you?