products

products.find

Returns the products that meet the given conditions.

JS
CR.api('commerce.products.find', request, function(response) { … });
HTTP
POST /open2b/api/v3/commerce.products.find

request

{
  "conditions" : { // returns only the products …
    "ids" : [ 281, 89, … ], // … with these identifiers - int(1…)
    "codes" : [ "FG94CA", "H9WM3", … ], // … with these codes - string(1…32)
    "isVisible" : true, // … that are visible or not visible on the shop - bool
    "hasZeroPrice" : false, // … that have zero price for the provided price list - 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…)
    "category" : 23, // … of this category (id) - int(1…)
    "producer" : 147, // … of this producer (id) - int(1…)
    "isAccessoryOf" : 862, // … accessory of this product (id) - int(1…)
    "isSimilarTo" : 302, // … similar to this product (id) - int(1…)
    "keywords" : [ "shirt", … ] // … with these keywords - string(1…100)
  },
  "language" : "en", // language ( ISO code ) of the texts to return - string(2)
  "priceList" : 1, // price list (id) - int(1…)
  "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", "sellingPrice", "-sellingPrice",
                        // "price", "-price", "rating", "-rating", "updateTime", "-updateTime" and "relevance" - string
  "limit" : 10, // maximum number of products to return - int(1…100)
  "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)
    "department" : 90, // department (id) - int(1…)
    "departments" : [ 28, 49, 63, 90, null ], // departments (ID) from the first to the last - int(1…) or null
    "producer" : 290, // producer (id) (can be null) - int(1…)
    "category" : 19, // category (id) (can be null) - int(1…)
    "isVisible" : true, // indicates if it is visible on the shop - bool
    "isFeatured" : false, // indicates if it is featured on the home page - bool
    "allowOrders" : true, // indicates if can be ordered - bool
    "minOrder" : 1, // minimum order quantity acceptable (can be null) - int(1…)
    "maxOrder" : 10, // maximum order quantity acceptable (can be null) - int(1…)
    "allowQuotes" : false, // indicates if can be quoted - bool
    "minQuote" : null, // minimum quotation quantity acceptable (can be null) - int(1…)
    "unitOfMeasure" : null, // unit of measure (ID) (can be null) - int(1…)
    "showPrice" : false, // indicates if the price is showed - bool
    "isNewRelease" : false, // indicates if it is a new release - bool
    "listPrice" : { // list prices for each price list - int(1…) -> decimal[10,3](0…)
      "1" : 56.335,
      "3" : 60.050,
      "4" : 54.100,
      …
    },
    "sellingPrice" : { // selling prices for each price list - int(1…) -> decimal[10,3](0…)
      "1" : 54.120,
      "3" : 58.805,
      "4" : 51.000,
      …
    },
    "price" : { // prices for each price list - int(1…) -> decimal[10,3](0…)
      "1" : 50.109,
      "3" : 56.420,
      "4" : 49.555,
      …
    },
    "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" : "http://…", // url - string(10…)
      "url2x" : "http://…", // url of retina, double resolution, image (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" : "http://…", // url - string(10…)
      "url2x" : "http://…", // double resolution image 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" : "http://…", // url - string(10…)
      "url2x" : "http://…", // double resolution image 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" : "http://…", // url - string(10…)
      "url2x" : "http://…", // double resolution image 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" : "http://…", // url - string(10…)
      "url2x" : "http://…", // double resolution image 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" : "",
      …
    },
    "seoKeywords" : { // keywords 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" : "2013-05-10", // date when it will be available if it is pre-ordinable (can be null) - date
    "taxClass" : 5, // tax class (id) (can be null) - int(1…)
    "promotion" : null, // promotion (id) (can be null) - int (1…)
    "hasVariants" : true, // indicates if it has variants - bool
    "variants" : [ 24, 8, null ], // variants (id) - int(1…) or null
    "updateTime" : "2013-09-05 10:55:39" // last update time - datetime
  }, … ]
}

Errors

Field Type Description
conditions Malformed Condition 'isAccessoryOf' cannot be used in combination with 'hasZeroPrice'
conditions Malformed Condition 'isSimilarTo' cannot be used in combination with 'hasZeroPrice'
conditions Malformed Condition 'isSimilarTo' cannot be used in combination with 'isAccessoryOf'
conditions Malformed There can be at most 5 keywords
priceList InvalidCombination Price list is required if products have to be ordered by price
priceList InvalidCombination Price list is required if condition 'hasZeroPrice' is provided
priceList NotFound Price list <priceList> does not exist

products.get

Returns a product given its identifier.

JS
CR.api('commerce.products.get', request, function(response) { … });
HTTP
POST /open2b/api/v3/commerce.products.get

request

{
  "id" : 281, // identifier (required) - int(1…)
  "language" : "en", // language ( ISO code ) of the texts to return - string(2)
  "priceList" : 1, // price list (id) - int(1…)
  "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)
    "department" : 90, // department (id) - int(1…)
    "departments" : [ 28, 49, 63, 90, null ], // departments (ID) from the first to the last - int(1…) or null
    "producer" : 290, // producer (id) (can be null) - int(1…)
    "category" : 19, // category (id) (can be null) - int(1…)
    "isVisible" : true, // indicates if it is visible on the shop - bool
    "isFeatured" : false, // indicates if it is featured on the home page - bool
    "allowOrders" : true, // indicates if can be ordered - bool
    "minOrder" : 1, // minimum order quantity acceptable (can be null) - int(1…)
    "maxOrder" : 10, // maximum order quantity acceptable (can be null) - int(1…)
    "allowQuotes" : false, // indicates if can be quoted - bool
    "minQuote" : null, // minimum quotation quantity acceptable (can be null) - int(1…)
    "unitOfMeasure" : null, // unit of measure (ID) (can be null) - int(1…)
    "showPrice" : false, // indicates if the price is showed - bool
    "isNewRelease" : false, // indicates if it is a new release - bool
    "listPrice" : { // list prices for each price list - int(1…) -> decimal[10,3](0…)
      "1" : 56.335,
      "3" : 60.050,
      "4" : 54.100,
      …
    },
    "sellingPrice" : { // selling prices for each price list - int(1…) -> decimal[10,3](0…)
      "1" : 54.120,
      "3" : 58.805,
      "4" : 51.000,
      …
    },
    "price" : { // prices for each price list - int(1…) -> decimal[10,3](0…)
      "1" : 50.109,
      "3" : 56.420,
      "4" : 49.555,
      …
    },
    "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" : "http://…", // url - string(10…)
      "url2x" : "http://…", // url of retina, double resolution, image (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" : "http://…", // url - string(10…)
      "url2x" : "http://…", // double resolution image 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" : "http://…", // url - string(10…)
      "url2x" : "http://…", // double resolution image 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" : "http://…", // url - string(10…)
      "url2x" : "http://…", // double resolution image 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" : "http://…", // url - string(10…)
      "url2x" : "http://…", // double resolution image 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" : "",
      …
    },
    "seoKeywords" : { // keywords 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" : "2013-05-10", // date when it will be available if it is pre-ordinable (can be null) - date
    "taxClass" : 5, // tax class (id) (can be null) - int(1…)
    "promotion" : null, // promotion (id) (can be null) - int (1…)
    "hasVariants" : true, // indicates if it has variants - bool
    "variants" : [ 24, 8, null ], // variants (id) - int(1…) or null
    "updateTime" : "2013-09-05 10:55:39" // last update time - datetime
    }
}

products.count

Number of products that meet the given conditions.

JS
CR.api('commerce.products.count', request, function(response) { … });
HTTP
POST /open2b/api/v3/commerce.products.count

request

{
  "conditions" : { // counts only the products …
    "ids" : [ 281, 89, … ], // … with these identifiers - int(1…)
    "codes" : [ "FG94CA", "H9WM3", … ], // … with these codes - string(1…32)
    "isVisible" : true, // … that are visible or not visible on the shop - bool
    "hasZeroPrice" : false, // … that have zero price for the provided price list - 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…)
    "category" : 23, // … of this category (id) - int(1…)
    "producer" : 147, // … of this producer (id) - int(1…)
    "isAccessoryOf" : 862, // … accessory of this product (id) - int(1…)
    "isSimilarTo" : 302, // … similar to this product (id) - int(1…)
    "keywords" : [ "shirt", … ] // … with these keywords - string(1…100)
  },
  "language" : "en" // language ( ISO code ) of the texts in the conditions - string(2)
  "priceList" : 1, // price list (id) for "has zero price" condition - int(1…)
}

response

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

Errors

Field Type Description
conditions Malformed Condition 'isAccessoryOf' cannot be used in combination with 'hasZeroPrice'
conditions Malformed Condition 'isSimilarTo' cannot be used in combination with 'hasZeroPrice'
conditions Malformed Condition 'isSimilarTo' cannot be used in combination with 'isAccessoryOf'
priceList InvalidCombination Price list is required if condition 'hasZeroPrice' is provided

products.create

Creates a product and one or more items.

JS
CR.api('commerce.products.create', request, function(response) { … });
HTTP
POST /open2b/api/v3/commerce.products.create

request

{
  "product" : { // product to create (required)
    "code" : "FG94CA", // code (required) - string(1…32)
    "department" : 63, // department (id) (required) - int(1…)
    "producer" : 290, // producer (id) (can be null) - int(1…)
    "category" : 19, // category (id) (can be null) - int(1…)
    "isVisible" : true, // indicates if it is visible on the shop - 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 // minimum order quantity acceptable - int(1…)
    "maxOrder" : 10, // maximum order quantity acceptable (can be null) - int(1…)
    "allowQuotes" : true, // indicates if can be quoted - bool
    "minQuote" : 11, // minimum quotation quantity acceptable - int(1…)
    "unitOfMeasure" : null, // unit of measure (ID) (can be null) - int(1…)
    "rating" : 4.7, // rating - decimal[2,1](1…5)
    "showMoreGalleries" : false, // Indicates if should be showen more image galleries or only one - 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" : ""
    },
    "seoKeywords" : { // keywords 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" : "2013-05-10", // date when it will be available if it is pre-ordinable (can be null) - date
    "taxClass" : 5, // tax class (id) (can be null) - int(1…)
    "variants" : [ 24, 8, null ], // variants (id) - int(1…)
    "items" : [ { // items (required)
      "sku" : "FG94CA", // item SKU (required) - string(1…32)
      "barcode" : "09781555553333", // GTIN barcode ( EAN13, UPC o ISBN13 ) (can be null) - string(14)
      "listPrice" : { // list prices for each price list - int(1…) -> decimal[10,3](0…)
        "1" : 56.335,
        "3" : 60.050,
        "4" : 54.100
      },
      "sellingPrice" : { // selling prices for each price list - int(1…) -> decimal[10,3](0…)
        "1" : 54.120,
        "3" : 58.805,
        "4" : 51.000
      },
      "costPrice" : 30.790, // cost price - decimal[10,3](0…)
      "supplier" : 7201, // supplier (id) (can be null) - int(1…)
      "supplierSKU" : "DF0261C", // supplier SKU - string(0…32)
      "stock" : 62, // quantity in stock - int(0…)
      "stockLevel" : 90, // stock level - int(0…32000)
      "reorderLimit" : 10, // reorder limit - int(0…32000)
      "orderEvenNotAvailable" : true, // indicates if it is ordinable even if it is not available - bool
      "reorderDays" : 5, // giorni di attesa perché ritorni disponibile - int(0…255)
      "weight" : 0.452, // weight - decimal[6,3](0…)
      "options" : [ 46, 19, null ] // options (id) - int(1…)
    }, … ]
  }
}

response

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

Errors

Field Type Description
barcode Malformed <barcode> is not a GTIN barcode
category NotFound Category <category> does not exist
code AlreadyExists Product code '<code>' already exists
department InvalidValue Department <department> contains subdepartments
department NotFound Department <department> does not exist
listPrice InvalidValue Price list <priceList> can not be changed because is not a base list
listPrice NotFound Price list <priceList> does not exist
maxOrder Malformed Maximum order can not be less than minimum order
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
sellingPrice InvalidValue Price list <priceList> can not be changed because is not a base list
sellingPrice InvalidValue Price list <priceList> does not exist
supplier NotFound Supplier <supplier> does not exist
unitOfMeasure NotFound Unit of measure <unitOfMeasure> does not exist

products.update

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

JS
CR.api('commerce.products.update', request, function(response) { … });
HTTP
POST /open2b/api/v3/commerce.products.update

request

{
  "id" : 281, // identifier of the product to update (required)
  "product" : { // product's fields to update (required)
    "code" : "FG94CA", // code - string(1…32)
    "department" : 63, // department (id) - int(1…)
    "producer" : 290, // producer (id) (can be null) - int(1…)
    "category" : 19, // category (id) (can be null) - int(1…)
    "isVisible" : true, // indicates if it is visible on the shop - 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, // minimum order quantity acceptable - int(1…)
    "maxOrder" : 10, // maximum order quantity acceptable (can be null) - int(1…)
    "allowQuotes" : true, // indicates if can be quoted - bool
    "minQuote" : 11, // minimum quotation quantity acceptable - int(1…)
    "unitOfMeasure" : null, // unit of measure (ID) (can be null) - int(1…)
    "rating" : 4.7, // rating - decimal[2,1](0…5)
    "showMoreGalleries" : false, // Indicates if should be showen more image galleries or only one - 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" : ""
    },
    "seoKeywords" : { // keywords 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" : "2013-05-10", // date when it will be available if it is pre-ordinable (can be null) - date
    "taxClass" : 5, // tax class (id) (can be null) - int(1…)
    "variants" : [ 24, 8, null ] // variants (id) - int(1…) or null
  }
}

response

{
  "status" : "ok"
}

Errors

Field Type Description
id NotFound Product <id> does not exist
code AlreadyExists Product code '<code>' already exists
department NotFound Department <department> does not exist
department InvalidValue Department <department> contains subdepartments
producer NotFound Producer <producer> does not exist
category NotFound Category <category> does not exist
taxClass NotFound Tax class <taxClass> does not exist
listPrice InvalidValue List price <listPrice> is less than selling price <SellingPrice>
variants Malformed 'variants' has more than three ids
variants NotFound Variant <variant> does not exist

products.update-ratings

Updates one or more product ratings.

JS
CR.api('commerce.products.update-ratings', request, function(response) { … });
HTTP
POST /open2b/api/v3/commerce.products.update-ratings

request

{
  "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.

JS
CR.api('commerce.products.add-relations', request, function(response) { … });
HTTP
POST /open2b/api/v3/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 InvalidValue Product <id> does not exist
related InvalidValue Product <id> does not exist

products.remove-relations

Removes one o more products from a relation.

JS
CR.api('commerce.products.remove-relations', request, function(response) { … });
HTTP
POST /open2b/api/v3/commerce.products.remove-relations

request

{
  "id" : 281, // identifier of the product from witch 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 - int(1…)
}

response

{
  "status" : "ok"
}

Errors

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

products.delete

Deletes one or more products and all their items.

JS
CR.api('commerce.products.delete', request, function(response) { … });
HTTP
POST /open2b/api/v3/commerce.products.delete

request

{
  "ids" : [ 281, 89, … ] // identifiers of the products to delete (required) - int(1…)
}

response

{
  "status" : "ok"
}