Open2b versione 7.2

products

products.find

Returns the products that meet the given conditions.

Request

Admin SDK
Admin.api('commerce.products.find', request, function(response) { … });
HTTP POST
/api/v8/commerce.products.find
{
  "conditions" : { // returns only the products …
    "ids" : [ 281, 89, … ], // … with these identifiers - int(1…)
    "codes" : [ "FG94CA", "H9WM3", … ], // … with these codes - string(1…40)
    "isVisible" : true, // … that are visible or not visible on the store - bool
    "hasPrice" : false, // … that has price for the provided customer group - bool
    "isFeatured" : false, // … that are featured or not featured on the home page - bool
    "isNewRelease" : false, // … that are new releases or not - bool
    "allowOrders" : true, // … that allow orders or not - bool
    "allowQuotes" : false, // … that allow quotes or not - bool
    "department" : 34, // … contained in this department (id) - int(1…)
    "producer" : 147, // … of this producer (id) - int(1…)
    "collections" : [ 8, 22, 54, … ], // … that belongs to one of these collections (id) - int(1…)
    "isAccessoryOf" : 862, // … accessory of this product (id) - int(1…)
    "isSimilarTo" : 302, // … similar to this product (id) - int(1…)
    "salePriceFrom" : 10.500, // … with the sale price starting from this - decimal[10,3](0…)
    "salePriceTo" : 50.800, // … with the sale price up to this - decimal[10,3](0…)
    "promotion" : 12, // … that has this promotion (id) - int(1…)
    "keywords" : [ "shirt", … ], // … with these keywords - string(1…100)
    "attributes" : { // … with these attributes and values - int(1…) -> int(1…)
        "3" : [ 5, 7, … ],
        "12" : [ 2, 4, … ],
        …
    },
    "labels" : [ 1, 3, … ], // … with these labels - int(1…64)
    "after" : 281 // … with identifier after this value - int(0…)
  },
  "language" : "en", // language ( ISO code ) of the texts to return - string(2)
  "group" : 3, // customer group (id) - int(1…255)
  "fields" : [ "id", "code", … ], // fields to return - string
  "order" : [ "name" ], // sort order of returned products, can contain "id", "-id", "code", "-code", "isVisible", "-isVisible",
                        // "name", "-name", "position", "-position", "listPrice", "-listPrice", "salePrice", "-salePrice",
                        // "rating", "-rating", "updateTime", "-updateTime" and "relevance" - string
  "limit" : 10, // maximum number of products to return - int(1…)
  "first" : 0 // index of the first product to return - int(0…)
}

Response

{
  "status" : "ok",
  "products" : [ {
    "id" : 281, // identifier - int(1…)
    "code" : "FG94CA", // code - string(1…40)
    "sku" : "FG94CA-1", // SKU of the main item - string(1…40)
    "departments" : [ 63, 12 ], // departments (id), one or more, up to 5 - int(1…)
    "producer" : 290, // producer (id) (can be null) - int(1…)
    "isVisible" : true, // indicates if it is visible on the store - bool
    "isFeatured" : false, // indicates if it is featured on the home page - bool
    "allowOrders" : true, // indicates if can be ordered - bool
    "minOrder" : 1.00, // minimum order quantity acceptable, greater than zero - decimal[8,2](0…)
    "maxOrder" : 10.00, // maximum order quantity acceptable, greater than zero (can be null) - decimal[8,2](0…)
    "allowQuotes" : false, // indicates if can be quoted - bool
    "minQuote" : null, // minimum quotation quantity acceptable, greater than zero (can be null) - decimal[8,2](0…)
    "showPrice" : false, // indicates if the price is showed - bool
    "isNewRelease" : false, // indicates if it is a new release - bool
    "listPrice" : { // list price for each customer group - int(1…255) -> decimal[10,3](0…)
      "4" : 56.335, // (can be null)
      "5" : 60.050, // (can be null)
      "8" : 54.100, // (can be null)
      …
    },
    "salePrice" : { // sale price for each customer group - int(1…255) -> decimal[10,3](0…)
      "4" : 54.120, // (can be null)
      "5" : 58.805, // (can be null)
      "8" : 51.000, // (can be null)
      …
    },
    "hasMorePrices" : { // indicates if it has more prices for each customer group - bool
      "4" : false,
      "5" : false,
      "8" : true,
      …
    },
    "promotion" : { // promotion (id) for each customer group - int(1…255) -> int(1…)
      "4" : 58, // (can be null)
      "5" : null, // (can be null)
      "8" : 103, // (can be null)
      …
    },
    "rating" : 4.7, // rating - decimal[2,1](0…5)
    "showMoreGalleries" : false, // Indicates if should be showen more image galleries or only one - bool
    "thumbnailImage" : { // thumbnail main image (can be null)
      "url" : "https://…", // url - string(10…)
      "url2x" : "https://…", // double resolution url (can be null) - string(10…)
      "width" : 40, // width in pixel - int(30…50)
      "height" : 40 // height in pixel - int(30…50)
    },
    "smallImage" : { // small main image (can be null)
      "url" : "https://…", // url - string(10…)
      "url2x" : "https://…", // double resolution url (can be null) - string(10…)
      "width" : 70, // width in pixel - int(50…250)
      "height" : 70 // height in pixel - int(50…250)
    },
    "mediumImage" : { // medium main image (can be null)
      "url" : "https://…", // url - string(10…)
      "url2x" : "https://…", // double resolution url (can be null) - string(10…)
      "width" : 150, // width in pixel - int(50…250)
      "height" : 150 // height in pixel - int(50…250)
    },
    "largeImage" : { // large main image (can be null)
      "url" : "https://…", // url - string(10…)
      "url2x" : "https://…", // double resolution url (can be null) - string(10…)
      "width" : 300, // width in pixel - int(250…800)
      "height" : 300 // height in pixel - int(250…800)
    },
    "zoomImage" : { // zoom main image (can be null)
      "url" : "https://…", // url - string(10…)
      "url2x" : "https://…", // double resolution url (can be null) - string(10…)
      "width" : 1200, // width in pixel - int(250…)
      "height" : 1200 // height in pixel - int(250…)
    },
    "name" : { // name - string(2) -> string(0…120)
      "en" : "Book",
      "it" : "Libro",
      …
    },
    "shortDescription" : { // short description - string(2) -> string(0…255)
      "en" : "",
      "it" : "",
      …
    },
    "longDescription" : { // long description - string(2) -> string(0…65535)
      "en" : "",
      "it" : "",
      …
    },
    "moreDescription" : { // more description - string(2) -> string(0…65535)
      "en" : "",
      "it" : "",
      …
    },
    "infoForRequests" : { // information for customer requests - string(2) -> string(0…255)
      "en" : "",
      "it" : "",
      …
    },
    "seoTitle" : { // title for SEO - string(2) -> string(0…255)
      "en" : "",
      "it" : "",
      …
    },
    "seoDescription" : { // description for SEO - string(2) -> string(0…255)
      "en" : "",
      "it" : "",
      …
    },
    "canonicalURL" : { // canonical URL - string(2) -> string(10…)
      "en" : "https://www.site.com/book",
      "it" : "https://www.site.com/it/libro",
      …
    },
    "position" : 3, // position when it is displayed with other products - int(0…4)
    "releaseDate" : "2020-05-10", // date when it will be available if it is pre-orderable (can be null) - date
    "taxClass" : 5, // tax class (id) (can be null) - int(1…)
    "attributesView" : 12, // attributes view (can be null) - int(1…)
    "attributes" : {  // attributes, attribute values for each attribute - int(1…) -> int(1…)
      "3" : [ 5, 7 ],
      "12" : [ 2, 4 ]
    },
    "hasVariants" : true, // indicates if it has variants - bool
    "variants" : [ 24, 8, null ], // variants (id) - int(1…) or null
    "updateTime" : "2020-09-05 10:55:39" // last update time - datetime
  }, … ]
}

Errors

Field Type Description
conditions Malformed 'salePriceFrom' must be less or equal to 'salePriceTo'
conditions Malformed Condition 'isSimilarTo' cannot be used in combination with 'isAccessoryOf'
conditions Malformed There can be at most 5 keywords
group InvalidCombination Customer group is required if 'promotion' condition is provided
group InvalidCombination Customer group is required if 'salePriceFrom' condition is provided
group InvalidCombination Customer group is required if 'salePriceTo' condition is provided
group InvalidCombination Customer group is required if products have to be ordered by price
group NotFound Customer group <group> does not exist
language NotFound Language <language> does not exist

products.get

Returns a product given its identifier.

Request

Admin SDK
Admin.api('commerce.products.get', request, function(response) { … });
HTTP POST
/api/v8/commerce.products.get
{
  "id" : 281, // identifier (required) - int(1…)
  "language" : "en", // language ( ISO code ) of the texts to return - string(2)
  "group" : 3, // customer group (id) - int(1…255)
  "fields" : [ "id", "code", "name", … ] // fields to return - string
}

Response

{
  "status" : "ok",
  "product" : { // (can be null)
    "id" : 281, // identifier - int(1…)
    "code" : "FG94CA", // code - string(1…40)
    "sku" : "FG94CA-1", // SKU of the main item - string(1…40)
    "departments" : [ 63, 12 ], // departments (id), one or more, up to 5 - int(1…)
    "producer" : 290, // producer (id) (can be null) - int(1…)
    "isVisible" : true, // indicates if it is visible on the store - bool
    "isFeatured" : false, // indicates if it is featured on the home page - bool
    "allowOrders" : true, // indicates if can be ordered - bool
    "minOrder" : 1.00, // minimum order quantity acceptable, greater than zero - decimal[8,2](0…)
    "maxOrder" : 10.00, // maximum order quantity acceptable, greater than zero (can be null) - decimal[8,2](0…)
    "allowQuotes" : false, // indicates if can be quoted - bool
    "minQuote" : null, // minimum quotation quantity acceptable, greater than zero (can be null) - decimal[8,2](0…)
    "showPrice" : false, // indicates if the price is showed - bool
    "isNewRelease" : false, // indicates if it is a new release - bool
    "listPrice" : { // list price for each customer group - int(1…255) -> decimal[10,3](0…)
      "4" : 56.335, // (can be null)
      "5" : 60.050, // (can be null)
      "8" : 54.100, // (can be null)
      …
    },
    "salePrice" : { // sale price for each customer group - int(1…255) -> decimal[10,3](0…)
      "4" : 54.120, // (can be null)
      "5" : 58.805, // (can be null)
      "8" : 51.000, // (can be null)
      …
    },
    "hasMorePrices" : { // indicates if it has more prices for each customer group - bool
      "4" : false,
      "5" : false,
      "8" : true,
      …
    },
    "promotion" : { // promotion (id) for each customer group - int(1…255) -> int(1…)
      "4" : 58, // (can be null)
      "5" : null, // (can be null)
      "8" : 103, // (can be null)
      …
    },
    "rating" : 4.7, // rating - decimal[2,1](0…5)
    "showMoreGalleries" : false, // Indicates if should be showen more image galleries or only one - bool
    "thumbnailImage" : { // thumbnail main image (can be null)
      "url" : "https://…", // url - string(10…)
      "url2x" : "https://…", // double resolution url (can be null) - string(10…)
      "width" : 40, // width in pixel - int(30…50)
      "height" : 40 // height in pixel - int(30…50)
    },
    "smallImage" : { // small main image (can be null)
      "url" : "https://…", // url - string(10…)
      "url2x" : "https://…", // double resolution url (can be null) - string(10…)
      "width" : 70, // width in pixel - int(50…250)
      "height" : 70 // height in pixel - int(50…250)
    },
    "mediumImage" : { // medium main image (can be null)
      "url" : "https://…", // url - string(10…)
      "url2x" : "https://…", // double resolution url (can be null) - string(10…)
      "width" : 150, // width in pixel - int(50…250)
      "height" : 150 // height in pixel - int(50…250)
    },
    "largeImage" : { // large main image (can be null)
      "url" : "https://…", // url - string(10…)
      "url2x" : "https://…", // double resolution url (can be null) - string(10…)
      "width" : 300, // width in pixel - int(250…800)
      "height" : 300 // height in pixel - int(250…800)
    },
    "zoomImage" : { // zoom main image (can be null)
      "url" : "https://…", // url - string(10…)
      "url2x" : "https://…", // double resolution url (can be null) - string(10…)
      "width" : 1200, // width in pixel - int(250…)
      "height" : 1200 // height in pixel - int(250…)
    },
    "name" : { // name - string(2) -> string(0…120)
      "en" : "Book",
      "it" : "Libro",
      …
    },
    "shortDescription" : { // short description - string(2) -> string(0…255)
      "en" : "",
      "it" : "",
      …
    },
    "longDescription" : { // long description - string(2) -> string(0…65535)
      "en" : "",
      "it" : "",
      …
    },
    "moreDescription" : { // more description - string(2) -> string(0…65535)
      "en" : "",
      "it" : "",
      …
    },
    "infoForRequests" : { // information for customer requests - string(2) -> string(0…255)
      "en" : "",
      "it" : "",
      …
    },
    "seoTitle" : { // title for SEO - string(2) -> string(0…255)
      "en" : "",
      "it" : "",
      …
    },
    "seoDescription" : { // description for SEO - string(2) -> string(0…255)
      "en" : "",
      "it" : "",
      …
    },
    "canonicalURL" : { // canonical URL - string(2) -> string(10…)
      "en" : "https://www.site.com/book",
      "it" : "https://www.site.com/it/libro",
      …
    },
    "position" : 3, // position when it is displayed with other products - int(0…4)
    "releaseDate" : "2020-05-10", // date when it will be available if it is pre-orderable (can be null) - date
    "taxClass" : 5, // tax class (id) (can be null) - int(1…)
    "attributesView" : 12, // attributes view (can be null) - int(1…)
    "attributes" : {  // attributes, attribute values for each attribute - int(1…) -> int(1…)
      "3" : [ 5, 7 ],
      "12" : [ 2, 4 ]
    },
    "hasVariants" : true, // indicates if it has variants - bool
    "variants" : [ 24, 8, null ], // variants (id) - int(1…) or null
    "updateTime" : "2020-09-05 10:55:39" // last update time - datetime
  }
}

Errors

Field Type Description
group NotFound Customer group <group> does not exist

products.count

Number of products that meet the given conditions.

Request

Admin SDK
Admin.api('commerce.products.count', request, function(response) { … });
HTTP POST
/api/v8/commerce.products.count
{
  "conditions" : { // counts only the products …
    "ids" : [ 281, 89, … ], // … with these identifiers - int(1…)
    "codes" : [ "FG94CA", "H9WM3", … ], // … with these codes - string(1…40)
    "isVisible" : true, // … that are visible or not visible on the store - bool
    "hasPrice" : false, // … that has price for the provided customer group - bool
    "isFeatured" : false, // … that are featured or not featured on the home page - bool
    "isNewRelease" : false, // … that are new releases or not - bool
    "allowOrders" : true, // … that allow orders or not - bool
    "allowQuotes" : false, // … that allow quotes or not - bool
    "department" : 34, // … contained in this department (id) - int(1…)
    "producer" : 147, // … of this producer (id) - int(1…)
    "collections" : [ 8, 22, 54, … ], // … that belongs to one of these collections (id) - int(1…)
    "isAccessoryOf" : 862, // … accessory of this product (id) - int(1…)
    "isSimilarTo" : 302, // … similar to this product (id) - int(1…)
    "salePriceFrom" : 10.500, // … with the sale price starting from this - decimal[10,3](0…)
    "salePriceTo" : 50.800, // … with the sale price up to this - decimal[10,3](0…)
    "promotion" : 12, // … that has this promotion (id) - int(1…)
    "keywords" : [ "shirt", … ], // … with these keywords - string(1…100)
    "attributes" : { // … with these attributes and values - int(1…) -> int(1…)
        "3" : [ 5, 7, … ],
        "12" : [ 2, 4, … ],
        …
    },
    "labels" : [ 1, 3, … ], // … with these labels - int(1…64)
    "after" : 281 // … with identifier after this value - int(0…)
  },
  "language" : "en", // language ( ISO code ) of the texts in the conditions - string(2)
  "group" : 3 // customer group (id) for price condition - int(1…)
}

Response

{
  "status" : "ok",
  "count" : 23 // number of products - int(0…)
}

Errors

Field Type Description
conditions Malformed 'salePriceFrom' must be less or equal to 'salePriceTo'
conditions Malformed Condition 'isSimilarTo' cannot be used in combination with 'isAccessoryOf'
conditions Malformed There can be at most 5 keywords
group InvalidCombination Customer group is required if 'hasPrice' condition is provided
group InvalidCombination Customer group is required if 'promotion' condition is provided
group InvalidCombination Customer group is required if 'salePriceFrom' condition is provided
group InvalidCombination Customer group is required if 'salePriceTo' condition is provided
group NotFound Customer group <group> does not exist
language NotFound Language <language> does not exist

products.create

Creates a product and one or more items.

Request

Admin SDK
Admin.api('commerce.products.create', request, function(response) { … });
HTTP POST
/api/v8/commerce.products.create
{
  "product" : { // product to create (required)
    "code" : "FG94CA", // code (required) - string(1…40)
    "departments" : [ 63, 12 ], // departments (id), one or more, up to 5 (required) - int(1…)
    "producer" : 290, // producer (id) (can be null) - int(1…)
    "isVisible" : true, // indicates if it is visible on the store - bool
    "isFeatured" : false, // indicates if it is featured on the home page - bool
    "isNewRelease" : false, // indicates if it is a new release - bool
    "showPrice" : false, // indicates if the price is showed - bool
    "allowOrders" : true, // indicates if can be ordered - bool
    "minOrder" : 1.00, // minimum order quantity acceptable, greater than zero - decimal[8,2](0…)
    "maxOrder" : 10.00, // maximum order quantity acceptable, greater than zero (can be null) - decimal[8,2](0…)
    "allowQuotes" : true, // indicates if can be quoted - bool
    "minQuote" : 11.00, // minimum quotation quantity acceptable, greater than zero - decimal[8,2](0…)
    "unitOfMeasure" : null, // unit of measure (id) (can be null) - int(1…)
    "rating" : 4.7, // rating - decimal[2,1](1…5)
    "showMoreGalleries" : false, // indicates whether multiple galleries or only one gallery should be displayed - bool
    "name" : { // name (required) - string(2) -> string(0…120)
      "en" : "",
      "it" : ""
    },
    "shortDescription" : { // short description - string(2) -> string(0…255)
      "en" : "",
      "it" : ""
    },
    "longDescription" : { // long description - string(2) -> string(0…65535)
      "en" : "",
      "it" : ""
    },
    "moreDescription" : { // more description - string(2) -> string(0…65535)
      "en" : "",
      "it" : ""
    },
    "infoForRequests" : { // order note label - string(2) -> string(0…255)
      "en" : "",
      "it" : ""
    },
    "seoTitle" : { // page title - string(2) -> string(0…255)
      "en" : "",
      "it" : ""
    },
    "seoDescription" : { // description for SEO - string(2) -> string(0…255)
      "en" : "",
      "it" : ""
    },
    "position" : 3, // position when it is displayed with other products - int(0…4)
    "releaseDate" : "2020-05-10", // date when it will be available if it is pre-orderable (can be null) - date
    "taxClass" : 5, // tax class (id) (can be null) - int(1…)
    "attributesView" : 12, // attributes view (id) (can be null) - int(1…)
    "attributes" : {  // attribute values for each attribute - int(1…) -> int(1…)
      "3" : [ 5, 7 ],
      "12" : [ 2, 4 ]
    },
    "variants" : [ 24, 8, null ], // variants (id) - int(1…)
    "items" : [ { // items (required)
      "sku" : "FG94CA", // item SKU (required) - string(1…40)
      "barcode" : "09781555553333", // GTIN barcode ( EAN13, UPC o ISBN13 ) (can be null) - string(14)
      "weight" : 0.452, // weight - decimal[6,3](0…)
      "width": 25, // width in centimeters - decimal[6,2](0…)
      "height": 18, // height in centimeters - decimal[6,2](0…)
      "depth": 7, // depth in centimeters - decimal[6,2](0…)
      "price" : { // price for each price list - int(1…255) -> decimal[10,3](0…)
        "1" : 56.335, // (can be null)
        "3" : 60.050, // (can be null)
        "4" : 54.100, // (can be null)
        …
      },
      "supplier" : 7201, // supplier (id) (can be null) - int(1…)
      "supplierSKU" : "DF0261C", // supplier SKU - string(0…40)
      "stock" : 62, // quantity in stock - decimal[11,2](0…)
      "stockLevel" : 90, // stock level - int(0…32000)
      "reorderLimit" : 10, // reorder limit - int(0…32000)
      "orderEvenNotAvailable" : true, // indicates if it can be ordered even if it is not available - bool
      "quantityStepsOn" : "Orders", // Indicates when quantity must be equal to, or a multiple of, the first tier quantity. Can be "Orders", "Quotes", "OrdersAndQuotes" (can be null) -- "Orders"
      "reorderDays" : 5, // days to wait before it returns available - int(0…255)
      "options" : [ 46, 19, null ] // options (id) - int(1…)
    }, … ]
  }
}

Response

{
  "status" : "ok",
  "id" : 281 // identifier of the new product - int(1…)
}

Errors

Field Type Description
attributes InvalidValue Attribute <attribute> is a variant for this product
attributes InvalidValue Attribute value <value> does not belong to attribute <attribute>
attributes Malformed An attribute value id is repeated
attributes NotFound Attribute <attribute> does not exist
attributes NotFound Attribute value <value> does not exist
attributeView NotFound Attribute view <attributeView> does not exist
barcode Malformed <barcode> is not a GTIN barcode
code AlreadyExists Product code '<code>' already exists
code Malformed Product code is empty
departments InvalidValue Department <department> contains subdepartments
departments NotFound Department <department> does not exist
maxOrder Malformed Maximum order can not be less than minimum order
options InvalidValue Option <option> does not belong to variant <variant>
options InvalidValue Product does not have the [first|second|third] variant
options NotFound Option <option> does not exist
price InvalidValue Price list <list> is not base
price NotFound Price list <list> does not exist
producer NotFound Producer <producer> does not exist
product LimitReached Maximum number of products has been reached
sku AlreadyExists Item SKU '<sku>' already exists
sku Malformed An item SKU is empty
sku Malformed SKU '<sku>' is repeated
supplier NotFound Supplier <supplier> does not exist
taxClass NotFound Tax class <taxClass> does not exist
unitOfMeasure NotFound Unit of measure <unitOfMeasure> does not exist
variants NotFound Variant <variant> does not exist

products.update

Updates a product. Any fields left out of the request will remain unchanged.

Request

Admin SDK
Admin.api('commerce.products.update', request, function(response) { … });
HTTP POST
/api/v8/commerce.products.update
{
  "id" : 281, // identifier of the product to update (required)
  "product" : { // product's fields to update (required)
    "code" : "FG94CA", // code - string(1…40)
    "departments" : [ 63, 12 ], // departments (id), one or more, up to 5 (required) - int(1…)
    "producer" : 290, // producer (id) (can be null) - int(1…)
    "isVisible" : true, // indicates if it is visible on the store - bool
    "isFeatured" : false, // indicates if it is featured on the home page - bool
    "isNewRelease" : false, // indicates if it is a new release - bool
    "showPrice" : false, // indicates if the price is showed - bool
    "allowOrders" : true, // indicates if can be ordered - bool
    "minOrder" : 1.00, // minimum order quantity acceptable, greater than zero - decimal[8,2](0…)
    "maxOrder" : 10.00, // maximum order quantity acceptable, greater than zero (can be null) - decimal[8,2](0…)
    "allowQuotes" : true, // indicates if can be quoted - bool
    "minQuote" : 11.00, // minimum quotation quantity acceptable, greater than zero - decimal[8,2](0…)
    "unitOfMeasure" : null, // unit of measure (id) (can be null) - int(1…)
    "rating" : 4.7, // rating - decimal[2,1](0…5)
    "showMoreGalleries" : false, // indicates whether multiple galleries or only one gallery should be displayed - bool
    "name" : { // name - string(2) -> string(0…120)
      "en" : "",
      "it" : ""
    },
    "shortDescription" : { // short description - string(2) -> string(0…255)
      "en" : "",
      "it" : ""
    },
    "longDescription" : { // long description - string(2) -> string(0…65535)
      "en" : "",
      "it" : ""
    },
    "moreDescription" : { // more description - string(2) -> string(0…65535)
      "en" : "",
      "it" : ""
    },
    "infoForRequests" : { // order note label - string(2) -> string(0…255)
      "en" : "",
      "it" : ""
    },
    "seoTitle" : { // title for SEO - string(2) -> string(0…255)
      "en" : "",
      "it" : ""
    },
    "seoDescription" : { // description for SEO - string(2) -> string(0…255)
      "en" : "",
      "it" : ""
    },
    "position" : 3, // position when it is displayed with other products - int(0…4)
    "releaseDate" : "2020-05-10", // date when it will be available if it is pre-orderable (can be null) - date
    "taxClass" : 5, // tax class (id) (can be null) - int(1…)
    "attributeView" : 12, // attribute view (can be null) - int(1…)
    "attributes" : {  // attribute values for each attribute - int(1…) -> int(1…)
      "3" : [ 5, 7 ],
      "12" : [ 2, 4 ]
    },
    "variants" : [ 24, 8, null ] // variants (id) - int(1…) or null
  }
}

Response

{
  "status" : "ok"
}

Errors

Field Type Description
attributes InvalidValue Attribute <attribute> is a variant for this product
attributes InvalidValue Attribute value <value> does not belong to attribute <attribute>
attributes Malformed An attribute value id is repeated
attributes NotFound Attribute <attribute> does not exist
attributes NotFound Attribute value <value> does not exist
attributeSet NotFound Attribute view <attributeView> does not exist
code AlreadyExists Product code '<code>' already exists
code Malformed Product code is empty
departments InvalidValue A product cannot be in more than 5 departments
departments InvalidValue Department <department> contains other departments
departments Malformed A department id is repeated
departments NotFound Department <department> does not exist
id NotFound Product <id> does not exist
producer NotFound Producer <producer> does not exist
taxClass NotFound Tax class <taxClass> does not exist
unitOfMeasure NotFound Unit of measure <unitOfMeasure> does not exist
variants Malformed 'variants' has more than three ids
variants NotFound Variant <variant> does not exist

products.update-ratings

Updates one or more product ratings.

Request

Admin SDK
Admin.api('commerce.products.update-ratings', request, function(response) { … });
HTTP POST
/api/v8/commerce.products.update-ratings
{
  "ratings" : { // id and rating for each product to update (required) - string(1…10) -> decimal[2,1](0…5)
    "281" : 4.7,
    "39" : 3.5,
    "682" : 5.0
  }
}

Response

{
  "status" : "ok"
}

products.add-relations

Adds some products to another product as related.

Admin SDK
Admin.api('commerce.products.add-relations', request, function(response) { … });
HTTP POST
/api/v8/commerce.products.add-relations

Request

{
  "id" : 281, // identifier of the product which add the related (required) - int(1…)
  "type" : "Accessory", // type of relation, can be "Accessory" or "Similar" (required) - string
  "related" : [ 39, 682, 205, … ] // related products (id) (required) - int(1…)
}

Response

{
  "status" : "ok"
}

Errors

Field Type Description
id InvalidValue Product <id> can not be related to itself
id NotFound Product <id> does not exist
related NotFound Product <id> does not exist

products.remove-relations

Removes one o more products from a relation.

Request

Admin SDK
Admin.api('commerce.products.remove-relations', request, function(response) { … });
HTTP POST
/api/v8/commerce.products.remove-relations
{
  "id" : 281, // identifier of the product from which remove the relations (required) - int(1…)
  "type" : "Accessory", // type of relation, can be "Accessory" or "Similar" (required) - string
  "related" : [ 39, 682, 205, … ] // related products (id), if null it removes all the relations (can be null) - int(1…)
}

Response

{
  "status" : "ok"
}

Errors

Field Type Description
id NotFound Product <id> does not exist

products.delete

Deletes one or more products and all their items.

Request

Admin SDK
Admin.api('commerce.products.delete', request, function(response) { … });
HTTP POST
/api/v8/commerce.products.delete
{
  "ids" : [ 281, 89, … ] // identifiers of the products to delete (required) - int(1…)
}

Response

{
  "status" : "ok"
}