Open2b versione 7.5

items

items.find

Returns the items that meet the given conditions.

Request

Admin SDK
Admin.api('commerce.items.find', request, function(response) { … });
HTTP POST
/api/v10/commerce.items.find
{
  "conditions" : { // returns only the items …
    "skus" : [ "A927TP", "C371PR", … ], // … with these SKUs - string(1…40)
    "isPrimary" : true, // … that are primary for their products - bool
    "hasPrice" : false, // … that has price for the provided price list or customer group - 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…)
    "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…40)
    "toReorder" : false, // … that should be reordered - bool
    "fromUpdateTime" : "2020-02-05 12:00:00", // … with update time after this date - datetime
    "after" : "A927TP" // … with identifier after this value - string(0…40)
  },
  "language" : "en", // language ( ISO code ) used in the conditions and for the texts to return - string(2)
  "list" : 3, // price list (id) or customer group (id) to return and use for price conditions - int(1…255)
  "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", "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…)
  "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)
    "departments" : [ 63, 12 ], // departments (id), one or more, up to 5 - int(1…)
    "producer" : 290, // product's producer (id) (can be null) - int(1…)
    "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 and customer group - int(1…255) -> decimal[10,3](0…)
      "1" : 50.100, // (can be null)
      "3" : 56.420, // (can be null)
      "4" : 49.555, // (can be null)
      …
    },
    "thumbnailImage" : { // thumbnail image (can be null)
      "url" : "https://…", // url - string(10…)
      "url2x" : "https://…", // double resolution url (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" : "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 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 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 image (can be null)
      "url" : "https://…", // url - string(10…)
      "url2x" : "https://…", // double resolution url (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 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)
    "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" : "2020-09-01 10:55:39" // last update time - datetime
  }, … ]
}

Errors

Field Type Description
barcode Malformed <barcode> is not a GTIN barcode
language NotFound Language <language> does not exist
list InvalidCombination Price list or customer group are required if 'hasPrice' condition is provided
list InvalidCombination Price list or customer group are required to sort by price
list NotFound Price list or customer group <list> does not exist

items.get

Returns an item given its SKU.

Request

Admin SDK
Admin.api('commerce.items.get', request, function(response) { … });
HTTP POST
/api/v10/commerce.items.get
{
  "sku" : "A927TP", // SKU of the item (required) - string(1…40)
  "language" : "en", // language ( ISO code ) of the texts to return - string(2)
  "list" : 3, // price list or customer group - int(1…255)
  "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)
    "departments" : [ 63, 12 ], // departments (id), one or more, up to 5 - int(1…)
    "producer" : 290, // product's producer (id) (can be null) - int(1…)
    "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 and customer group - int(1…255) -> decimal[10,3](0…)
      "1" : 50.100, // (can be null)
      "3" : 56.420, // (can be null)
      "4" : 49.555, // (can be null)
      …
    },
    "thumbnailImage" : { // thumbnail image (can be null)
      "url" : "https://…", // url - string(10…)
      "url2x" : "https://…", // double resolution url (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" : "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 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 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 image (can be null)
      "url" : "https://…", // url - string(10…)
      "url2x" : "https://…", // double resolution url (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 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)
    "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" : "2020-09-01 10:55:39" // last update time - datetime
  }
}

items.count

Number of items that meet the specified conditions.

Request

Admin SDK
Admin.api('commerce.items.count', request, function(response) { … });
HTTP POST
/api/v10/commerce.items.count
{
  "conditions" : { // counts only the items …
    "skus" : [ "A927TP", "C371PR", … ], // … with these SKUs - string(1…40)
    "isPrimary" : true, // … that are primary for their products - bool
    "hasPrice" : false, // … that has price for the provided price list or customer group - 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…)
    "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…40)
    "toReorder" : false, // … that should be reordered - bool
    "fromUpdateTime" : "2020-02-05 12:00:00", // … with update time after this date - datetime
    "after" : "A927TP" // … with identifier after this value - string(0…40)
  },
  "language" : "en", // language ( ISO code ) used in the conditions - string(2)
  "list" : 3 // price list (id) or customer group (id) for price conditions - int(1…255)
}

Response

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

Errors

Field Type Description
language NotFound Language <language> does not exist
list InvalidCombination Price list or customer group are required if 'hasPrice' condition is provided
list NotFound Price list or customer group <list> does not exist

items.create

Creates a new item.

Request

Admin SDK
Admin.api('commerce.items.create', request, function(response) { … });
HTTP POST
/api/v10/commerce.items.create
{
  "item" : { // item to create (required)
    "sku" : "A927TP", // SKU (required) - string(1…40)
    "product" : 295, // product (id) (required) - int(1…)
    "barcode" : "09781555553333", // GTIN barcode ( EAN13, UPC or 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.332, // (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.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 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"
}

Errors

Field Type Description
barcode Malformed <barcode> is not a GTIN barcode
options InvalidValue Option <option> does not belong to variant <variant>
options InvalidValue Product <product> does not have the [first|second|third] variant
options NotFound Option <option> does not exist
product NotFound Product <product> does not exist
sku AlreadyExists SKU '<sku>' already exists
sku Malformed SKU is empty
supplier NotFound Supplier <supplier> does not exist

items.update

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

Request

Admin SDK
Admin.api('commerce.items.update', request, function(response) { … });
HTTP POST
/api/v10/commerce.items.update
{
  "sku" : "A927TP", // SKU of the item to update (required) - string(1…40)
  "item" : { // item's fields to update (required)
    "sku" : "A927TP",  // new SKU - string(1…40)
    "barcode" : "09781555553333", // GTIN barcode ( EAN13, UPC or 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.332, // (can be null)
      "3" : 60.050, // (can be null)
      "4" : 54.100, // (can be null)
      …
    },
    "supplier" : 7201, // supplier (can be null) - int(1…)
    "supplierSKU" : "DF0261C", // supplier SKU - string(0…32)
    "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" : false, // 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" : 3, // days to wait before it returns available - int(0…255)
    "options" : [ 26, 31, null ] // options (id) - int(1…)
  }
}

Response

{
  "status" : "ok"
}

Errors

Field Type Description
barcode Malformed <barcode> is not a GTIN barcode
options InvalidValue Option <option> does not belong to variant <variant>
options InvalidValue Product <product> does not have the [first|second|third] variant
options Malformed 'options' has more than three ids
options NotFound Option <option> does not exist
sku AlreadyExists SKU '<sku>' already exists
sku Malformed SKU is empty
stockLevel InvalidValue Stock level <stockLevel> is not greater than reorder limit <reorderLimit>
supplier NotFound Supplier <supplier> does not exist

items.update-stock

Updates the stock of one or more items.

Request

Admin SDK
Admin.api('commerce.items.update-stock', request, function(response) { … });
HTTP POST
/api/v10/commerce.items.update-stock
{
  "stock" : { // SKU and stock quantity for each item to update (required) - string(1…40) -> 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 Can not update more than 100 items
stock Malformed There must be at least one item to update

items.delete

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

Request

Admin SDK
Admin.api('commerce.items.delete', request, function(response) { … });
HTTP POST
/api/v10/commerce.items.delete
{
  "skus" : [ "A927TP", "C371PR", … ] // skus of the items to delete (required) - string(1…40)
}

Response

{
  "status" : "ok"
}

Errors

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