/products
Loads a list of products or information on a single product.
URL parameters
Parameters that you can append to the URL, for example: ?parameter=value
Title | Type | Description | Required? |
---|---|---|---|
id | int | ID of a single product to load. Can be used after the slash. Example: products/27 load product with ID 27 | No |
page | int | Number of the page to load. Defaults to 1 | No |
sort | string | One or more attributes to sort the items by. Defaults to id descending. For descending, add ! before the attribute name. For multiple attributes, separate them by commas. Example: products?sort=!id,title sort by descending id first, then by ascending email | No |
size | int | Number of items per page. Defaults to 20 | No |
expand | string | Relations that should be extended. Possible options: textareas, images, variants, options, all You can use multiple options separated by commas. Example: products?expand=textareas,images Load products with textareas and images Use all to load all relations. | No |
Response attributes
Attributes that you will receive in response from the endpoint in JSON format, for example:
{"id": 1,"title": "Product"}
Title | Type | Description |
---|---|---|
id | int | ID of the product |
title | string | Title of the product |
is_multi | bool | If the product is multi variant as opposed to single variant |
type | string | Type of the product, for example Shirts |
collections | array of ints | Array containing IDs of collections that the product belongs to. Only returns collections with manual addition of products |
tags | array of strings | Tags assigned to the product |
shipping_weight | float | Shipping weight of the product |
auto_fulfilment | bool | Whether automatic fulfilment is enabled |
track_inventory | bool | Whether product is tracked in Inventory |
vendor | string | Name of the vendor that supplies the product |
sku | string | SKU of the product |
seo_meta | string | Meta for SEO |
seo_title | string | Page title for SEO |
seo_url | string | Page URL for SEO. Generates automatically from title |
is_template | bool | Whether this is a template to create products from |
is_draft | bool | Whether this product is a draft that is not published |
price | float | Price of the product, for single variant products |
compare_price | float | Compare price of the product, for single variant products |
created_at | int | Timestamp of the product creation time |
updated_at | int | Timestamp of the product last update time |
textareas | object containing arrays | Custom pieces of text that can be displayed as tabs on the product page. Only the titles that have been pre-set on Product settings page can be used here |
textareas.name | string | Title of the tab. Only the titles that have been pre-set on Product settings page can be used here |
textareas.text | string | Text contents of the tab |
images | object containing arrays | Images for the product. Used if no variants change product look |
images.id | int | ID of the image |
images.path | string | Absolute URL of the image |
images.max_size | int | Max size of the image, for internal usage |
options | object containing arrays | Options for multi-variant products |
options.title | string | Title of the option, for example Color |
options.changes_look | bool | Whether this option changes look of the product |
options.values | array of strings | Values of the option, for example Red and Blue |
options.thumbnails | object containing arrays | Thumbnails that will be used in the variant selector on the product page |
options.thumbnails.value | string | Value of the option for which the thumbnail is used, for example Red |
options.thumbnails.color | string | Color of the selector thumbnail, HEX value. Either color or image is used. |
options.thumbnails.image | array of mixed | Image of the selector thumbnail. Either color or image is used. |
options.thumbnails.image.id | int | ID of the image, if image is used |
options.thumbnails.image.path | string | Absolute URL of the image, if image is used |
options.thumbnails.image.max_size | int | Max size of the image, for internal usage |
variants | object containing arrays | Variants resulting from combining of options |
variants.id | int | ID of the variant |
variants.variant | array of strings | A combination of options, for example Red and Big |
variants.price | float | Price of the variant |
variants.compare_price | float | Compare price of the variant |
variants.sku | string | SKU of the variant |
variants.default | bool | Whether the variant is default |
variants.ignore | bool | Whether the variant should not be used |
variants.images | object containing arrays | Images for the variant if it changes product look |
variants.images.id | int | ID of the image |
variants.images.path | string | Absolute URL of the image |
variants.images.max_size | int | Max size of the image, for internal usage |
GET https://mystore.commercehq.com/api/v1/products/14?expand=all
{
"id": 14,
"title": "Fancy bear 1000",
"is_multi": true,
"type": "Cats",
"collections": [6,7],
"tags": [
"dog"
],
"shipping_weight": 3000,
"auto_fulfilment": false,
"track_inventory": true,
"vendor": "Supplier #1",
"sku": "sku dog1000",
"seo_meta": null,
"seo_title": "Fancy bear 1000",
"seo_url": "fancy-bear-1000",
"is_template": false,
"is_draft": false,
"created_at": 1484929254,
"updated_at": 1485006377,
"textareas": [
{
"name": "Description",
"text": "Great product"
}
],
// for a single variant product
"images": [
{
"id": 18,
"path": "https://s3-us-west-2.amazonaws.com/commercehq-userfiles-dev/commercehq-test/uploads/1484915452_4bc11fff36e9ed964af6163f413bcb42.jpg",
"max_size": 6
},
{
"id": 17,
"path": "https://s3-us-west-2.amazonaws.com/commercehq-userfiles-dev/commercehq-test/uploads/1484915445_156e1fe7d4ac89c4b0567fc8c782e490.jpg",
"max_size": 7
}
],
// for a multi variant product
"options": [
{
"title": "Color",
"changes_look": true,
"values": [
"Red",
"Blue"
],
"thumbnails": [{
value: "Red",
color: "#BD3F3F"
}]
},
{
"title": "Size",
"changes_look": true,
"values": [
"Big",
"Small"
],
"thumbnails": [{
value: "Big",
image: {
id: "6",
path: "https://s3-us-west-2.amazonaws.com/commercehq-userfiles-dev/commercehq-test/uploads/1484915452_4bc11fff36e9ed964af6163f413bcb42.jpg",
max_size: 6
}
}]
}
],
"variants": [
{
"id": 43,
"variant": [
"Red",
"Big"
],
"price": 25,
"compare_price": 15,
"sku": null,
"default": true,
"ignore": false,
"images": [
{
"id": 19,
"path": "https://s3-us-west-2.amazonaws.com/commercehq-userfiles-dev/commercehq-test/uploads/1485006363_ceef7428ba5fb55b0cb73897fb2d8720.jpg",
"max_size": 9
}
]
},
{
"id": 44,
"variant": [
"Red",
"Small"
],
"price": 25,
"compare_price": 15,
"sku": null,
"default": false,
"ignore": false,
"images": []
},
{
"id": 45,
"variant": [
"Blue",
"Big"
],
"price": 25,
"compare_price": 15,
"sku": null,
"default": false,
"ignore": false,
"images": []
},
{
"id": 46,
"variant": [
"Blue",
"Small"
],
"price": 25,
"compare_price": 15,
"sku": null,
"default": false,
"ignore": false,
"images": []
}
]
}