items

items.find

Returns the items that meet the given conditions.

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

request

{
  "conditions" : { // returns only the items …
    "skus" : [ "A927TP", "C371PR", … ], // … with these SKUs - string(1…32)
    "isPrimary" : true, // … that are primary for their products - bool
    "barcode" : "09781555553333", // … with this GTIN barcode ( EAN13, UPC o ISBN13 ) - string(14)
    "options" : [ 46, 19, null ], // … with these options (id) - int(1…)
    "products" : [ 295, 97, … ] // … of these products (id) - int(1…)
    "department" : 34, // … contained in this department (id) - int(1…)
    "producer" : 147, // … of this producer (id) - int(1…)
    "category" : 23, // … of this category (id)- int(1…)
    "supplier" : 285, // … of this supplier (id)- int(1…)
    "keywords" : "shirt", // … with these words in SKU or Name - string(1…100)
    "isForSale" : true, // … that are for sale - bool
    "skuLessThan" : "C371PR", // … with SKU less than this - string(1…32)
    "toReorder" : false // … that should be reordered - bool
  },
  "language" : "en", // language ( ISO code ) used in the conditions and for the texts to return - string(2)
  "priceList" : 3, // price list - int(1…)
  "fields" : [ "sku", "product", "isPrimary", … ], // fields to return - string
  "order" : [ "sku" ], // sort order of returned items, can contain "sku", "-sku", "product", "-product", "barcode", "-barcode",
                       // "department", "-department", "producer", "-producer", "category", "-category", "listPrice", "-listPrice",
                       // "sellingPrice", "-sellingPrice","price", "-price", "name", "-name", "reorderDays", "-reorderDays",
                       // "quantityToReorder", "-quantityToReorder", "stock", "-stock", "stockLevel", "-stockLevel", "reorderLimit",
                       // "-reorderLimit", "supplier", "-supplier", "supplierSKU", "-supplierSKU", "updateTime" and "-updateTime" - string
  "limit" : 10, // maximum number of items to return - int(1…100)
  "first" : 50 // index of the first item to return - int(0…)
}

response

{
  "status" : "ok",
  "items" : [ {
    "sku" : "A927TP", // SKU - string(1…40)
    "product" : 295, // product (id) - int(1…)
    "isPrimary" : false, // indicates if it is the product's primary item - bool
    "barcode" : "09781555553333", // GTIN barcode ( EAN13, UPC or ISBN13 ) (can be null) - string(14)
    "department" : 63, // product's department (id) - int(1…)
    "producer" : 290, // product's producer (id) (can be null) - int(1…)
    "category" : 19, // product's category (id) (can be null) - int(1…)
    "weight" : 0.452, // weight - decimal[6,3](0…)
    "listPrice" : { // list price for each price list - int(1…) -> decimal[10,3](0…)
      "1" : 56.335,
      "3" : 60.050,
      "4" : 54.100,
      …
    },
    "sellingPrice" : { // selling price for each price list - int(1…) -> decimal[10,3](0…)
      "1" : 54.120,
      "3" : 58.805,
      "4" : 51.000,
      …
    },
    "price" : { // price for each price list - int(1…) -> decimal[10,3](0…)
      "1" : 50.100,
      "3" : 56.420,
      "4" : 49.555,
      …
    },
    "costPrice" : 30.793, // cost price - decimal[10,3](0…)
    "thumbnailImage" : { // thumbnail image (can be null)
      "url" : "http://…", // url - string(10…)
      "retinaURL" : "http://…", // url of retina, double resolution, image (can be null) - string(10…)
      "width" : 40, // width in pixels - int(1…)
      "height" : 30 // height in pixels - int(1…)
    },
    "smallImage" : { // small image (can be null)
      "url" : "http://…", // url - string(10…)
      "retinaURL" : "http://…", // url of retina, double resolution, image (can be null) - string(10…)
      "width" : 70, // width in pixel - int(50…250)
      "height" : 70 // height in pixel - int(50…250)
    },
    "mediumImage" : { // medium image (can be null)
      "url" : "http://…", // url - string(10…)
      "retinaURL" : "http://…", // url of retina, double resolution, image (can be null) - string(10…)
      "width"  : 150, // Width in pixel - int(50…250)
      "height" : 150 // height in pixel - int(50…250)
    },
    "largeImage" : { // large image (can be null)
      "url" : "http://…", // url - string(10…)
      "retinaURL" : "http://…", // url of retina, double resolution, image (can be null) - string(10…)
      "width" : 300, // width in pixel - int(250…800)
      "height" : 300 // height in pixel - int(250…800)
    },
    "zoomImage" : { // zoom image (can be null)
      "url" : "http://…", // url - string(10…)
      "retinaURL" : "http://…", // url of retina, double resolution, image (can be null) - string(10…)
      "width" : 800, // width in pixel - int(250…800)
      "height" : 800 // height in pixel - int(250…800)
    },
    "name" : { // product's name - string(2) -> string(0…120)
      "en" : "Book",
      "it" : "Libro",
      …
    },
    "isForSale" : true, // indicates if the product is for sale - bool
    "stock" : 62.00, // 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 is ordinable even if it is not available - bool
    "reorderDays" : 5, // Giorni di attesa perché ritorni disponibile - int(0…255)
    "quantityToReorder" : 0, // quantity to reorder from the suppliers - int(0…)
    "supplier" : 285, // supplier (id) (can be null) - int(1…)
    "supplierSKU" : "DF0261C", // supplier SKU - string(0…40)
    "options" : [ 46, 19, null ], // options (id) - int(1…)
    "taxClass" : 5, // product's tax class (id) (can be null) - int(1…)
    "updateTime" : "2013-09-01 10:55:39" // last update time - datetime
  }, … ]
}

items.get

Returns an item given its sku.

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

request

{
  "sku" : "A927TP", // SKU of the item (required) - string(1…32)
  "language" : "en", // language ( ISO code ) of the texts to return - string(2)
  "priceList" : 3, // price list - int(1…)
  "fields" : [ "sku", "product", "isPrimary", … ] // fields to return - string
}

response

{
  "status" : "ok",
  "item" : { // (can be null)
    "sku" : "A927TP", // SKU - string(1…40)
    "product" : 295, // product (id) - int(1…)
    "isPrimary" : false, // indicates if it is the product's primary item - bool
    "barcode" : "09781555553333", // GTIN barcode ( EAN13, UPC or ISBN13 ) (can be null) - string(14)
    "department" : 63, // product's department (id) - int(1…)
    "producer" : 290, // product's producer (id) (can be null) - int(1…)
    "category" : 19, // product's category (id) (can be null) - int(1…)
    "weight" : 0.452, // weight - decimal[6,3](0…)
    "listPrice" : { // list price for each price list - int(1…) -> decimal[10,3](0…)
      "1" : 56.335,
      "3" : 60.050,
      "4" : 54.100,
      …
    },
    "sellingPrice" : { // selling price for each price list - int(1…) -> decimal[10,3](0…)
      "1" : 54.120,
      "3" : 58.805,
      "4" : 51.000,
      …
    },
    "price" : { // price for each price list - int(1…) -> decimal[10,3](0…)
      "1" : 50.100,
      "3" : 56.420,
      "4" : 49.555,
      …
    },
    "costPrice" : 30.793, // cost price - decimal[10,3](0…)
    "thumbnailImage" : { // thumbnail image (can be null)
      "url" : "http://…", // url - string(10…)
      "retinaURL" : "http://…", // url of retina, double resolution, image (can be null) - string(10…)
      "width" : 40, // width in pixels - int(1…)
      "height" : 30 // height in pixels - int(1…)
    },
    "smallImage" : { // small image (can be null)
      "url" : "http://…", // url - string(10…)
      "retinaURL" : "http://…", // url of retina, double resolution, image (can be null) - string(10…)
      "width" : 70, // width in pixel - int(50…250)
      "height" : 70 // height in pixel - int(50…250)
    },
    "mediumImage" : { // medium image (can be null)
      "url" : "http://…", // url - string(10…)
      "retinaURL" : "http://…", // url of retina, double resolution, image (can be null) - string(10…)
      "width"  : 150, // Width in pixel - int(50…250)
      "height" : 150 // height in pixel - int(50…250)
    },
    "largeImage" : { // large image (can be null)
      "url" : "http://…", // url - string(10…)
      "retinaURL" : "http://…", // url of retina, double resolution, image (can be null) - string(10…)
      "width" : 300, // width in pixel - int(250…800)
      "height" : 300 // height in pixel - int(250…800)
    },
    "zoomImage" : { // zoom image (can be null)
      "url" : "http://…", // url - string(10…)
      "retinaURL" : "http://…", // url of retina, double resolution, image (can be null) - string(10…)
      "width" : 800, // width in pixel - int(250…800)
      "height" : 800 // height in pixel - int(250…800)
    },
    "name" : { // product's name - string(2) -> string(0…120)
      "en" : "Book",
      "it" : "Libro",
      …
    },
    "isForSale" : true, // indicates if the product is for sale - bool
    "stock" : 62.00, // 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 is ordinable even if it is not available - bool
    "reorderDays" : 5, // Giorni di attesa perché ritorni disponibile - int(0…255)
    "quantityToReorder" : 0, // quantity to reorder from the suppliers - int(0…)
    "supplier" : 285, // supplier (id) (can be null) - int(1…)
    "supplierSKU" : "DF0261C", // supplier SKU - string(0…40)
    "options" : [ 46, 19, null ], // options (id) - int(1…)
    "taxClass" : 5, // product's tax class (id) (can be null) - int(1…)
    "updateTime" : "2013-09-01 10:55:39" // last update time - datetime
  }
}

items.count

Number of items that meet the specified conditions.

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

request

{
  "conditions" : { // counts only the items …
    "skus" : [ "A927TP", "C371PR", … ], // … with these SKUs - string(1…32)
    "isPrimary" : true, // … that are primary for their products - bool
    "barcode" : "09781555553333", // … with this GTIN barcode ( EAN13, UPC o ISBN13 ) - string(14)
    "options" : [ 46, 19, null ], // … with these options (id) - int(1…)
    "products" : [ 295, 97, … ] // … of these products (id) - int(1…)
    "department" : 34, // … contained in this department (id) - int(1…)
    "producer" : 147, // … of this producer (id) - int(1…)
    "category" : 23, // … of this category (id)- int(1…)
    "supplier" : 285, // … of this supplier (id)- int(1…)
    "keywords" : "shirt", // … with these words in SKU or Name - string(1…100)
    "isForSale" : true, // … that are for sale - bool
    "skuLessThan" : "C371PR", // … with SKU less than this - string(1…32)
    "toReorder" : false // … that should be reordered - bool
  },
  "language" : "en" // language ( ISO code ) used in the conditions - string(2)
}

response

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

items.create

Creates a new item.

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

request

{
  "item" : { // item to create (required)
    "sku" : "A927TP", // SKU (required) - string(1…32)
    "product" : 295, // product (id) (required) - int(1…)
    "barcode" : "09781555553333", // GTIN barcode ( EAN13, UPC or ISBN13 ) (can be null) - string(14)
    "listPrice" : { // list price for each price list - int(1…) -> decimal[10,3](0…)
      "1" : 56.332,
      "3" : 60.050,
      "4" : 54.100
    },
    "sellingPrice" : { // selling price for each price list - int(1…) -> decimal[10,3](0…)
      "1" : 54.120,
      "3" : 58.805,
      "4" : 51.000
    },
    "costPrice" : 30.793, // 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 affinché ritorni disponibile - int(0…255)
    "weight" : 0.452, // weight - decimal[6,3](0…)
    "options" : [ 46, 19, null ] // options (id) - int(1…)
  }
}

response

{
  "status" : "ok"
}

Errors

Field Type Description
product NotFound Product <product> does not exist
options NotFound Option <option> does not exist

items.update

Updates an item. Any fields left out of the request will remain unchanged.

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

request

{
  "sku" : "A927TP", // SKU of the item to update (required) - string(1…32)
  "item" : { // item's fields to update (required)
    "sku" : "A927TP",  // new SKU - string(1…32)
    "barcode" : "09781555553333", // GTIN barcode ( EAN13, UPC or ISBN13 ) (can be null) - string(14)
    "listPrice" : { // list price for each price list - int(1…) -> decimal[10,3](0…)
      "1" : 56.332,
      "3" : 60.050,
      "4" : 54.100
    },
    "sellingPrice" : { // selling price for each price list - int(1…) -> decimal[10,3](0…)
      "1" : 54.120,
      "3" : 58.805,
      "4" : 51.000
    },
    "costPrice" : 30.793, // cost price - decimal[10,3](0…)
    "supplier" : 7201, // supplier (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" : false, // indicates if it is ordinable even if it is not available - bool
    "reorderDays" : 3, // giorni di attesa affinché ritorni disponibile - int(0…255)
    "weight" : 0.452, // weight - decimal[6,3](0…)
    "options" : [ 26, 31, null ] // options (id) - int(1…)
  }
}

response

{
  "status" : "ok"
}

Errors

Field Type Description
sku NotFound Item '<sku>' does not exist
stockLevel InvalidValue Stock level <stockLevel> is not greater than reorder limit <reorderLimit>
listPrice InvalidValue Price list <priceList> does not exist or is not a base price list
sellingPrice InvalidValue Price list <priceList> does not exist or is not a base price list

items.update-prices

Updates the prices of one or more items.

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

request

{
  "prices" : { // prices for each item to update (required)
    "A927TP" : { // sku - string(1…32)
      "list" : 56.332, // list price - decimal[10,3](0…)
      "selling" : 54.120, // selling price - decimal[10,3](0…)
    }
    …
  }
  "priceList" : 3 // base price list (ID) (required) - int(1…)
}

response

{
  "status" : "ok"
}

Errors

Field Type Description
prices Malformed There must be at least one item to update
priceList InvalidValue Price list <priceList> is not a base list
priceList NotFound Price list <priceList> does not exist
prices Malformed A SKU is empty
prices Malformed List price or selling price are required for each item to update
prices Malformed Can not update more than 100 items

items.update-stock

Updates the stock of one or more items.

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

request

{
  "stock" : { // sku and stock quantity for each item to update (required) - string(1…32) -> decimal[11,2](0…)
    "A927TP" : 23.00,
    "H129OL/2" : 58.55,
    …
  }
}

response

{
  "status" : "ok"
}

Errors

Field Type Description
stock Malformed A SKU is empty
stock Malformed There must be at least one item to update
stock Malformed Can not update more than 100 items

items.delete

Deletes one or more items. A primary item can be deleted only deleting the product.

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

request

{
  "skus" : [ "A927TP", "C371PR", … ] // skus of the items to delete (required) - string(1…32)
}

response

{
  "status" : "ok"
}

Errors

Field Type Description
skus Invalid Item '<sku>' is a main item