Open2b versione 7.5

item-prices

item-prices.find

Returns the prices of one or more items.

Request

Admin SDK
Admin.api('commerce.item-prices.find', request, function(response) { … });
HTTP POST
/api/v10/commerce.item-prices.find
{
  "conditions" : { // returns only the item prices …
    "skus" : [ "A927TP", "C371PR", … ], // … for these item SKUs - string(1…40)
    "lists" : [ 1, 4, … ], // … for these price lists (id) and customer groups (id) - int(1…255)
    "hasPrices" : true, // … that has a price for the item in the price list or customer group - bool
    "after" : { // … that SKU and price list or customer group are after these values
      "sku" : "C371PR", // SKU (required) - string(0…40)
      "list" : 5 // price list or customer group (required) - int(0…255)
    }
  },
  "limit" : 1000 // maximum number of item prices to return - int(1…)
}

Response

{
  "status" : "ok",
  "items" : [ {
    "sku" : "A927TP", // item SKU - string(1…40)
    "list" : 4, // price list (id) or customer group (id) - int(1…255)
    "price" : 54.120 // price (can be null) - decimal[10,3](0…)
  }, … ]
}

item-prices.find-tiers

Returns the tier prices of one or more items.

Request

Admin SDK
Admin.api('commerce.item-prices.find-tiers', request, function(response) { … });
HTTP POST
/api/v10/commerce.item-prices.find-tiers
{
  "conditions" : { // returns only the item prices …
    "skus" : [ "A927TP", "C371PR", … ], // … for these item SKUs - string(1…40)
    "lists" : [ 1, 4, … ], // … for these price lists (id) and customer groups (id) - int(1…255)
    "hasPrices" : true, // … that has a price for the item in the price list or customer group - bool
    "after" : { // … that SKU and price list or customer group are after these values
      "sku" : "C371PR", // SKU (required) - string(0…40)
      "list" : 5 // price list or customer group (required) - int(0…255)
    }
  },
  "limit" : 1000 // maximum number of item prices to return - int(1…)
}

Response

{
  "status" : "ok",
  "items" : [ {
    "sku" : "A927TP", // item SKU - string(1…40)
    "list" : 4, // price list (id) or customer group (id) - int(1…255)
    "prices" : { // price for each tier (can be null) - decimal[10,2](0…) -> decimal[10,3](0…)
        "1.00" : 56.335,
        "5.00" : 54.220,
        "10.00" : 51.950
    }
  }, … ]
}

Errors

Field Type Description
findTiers NotAvailable Price tiers are not available for this installation

item-prices.update

Updates the prices of one or more items.

Request

Admin SDK
Admin.api('commerce.item-prices.update', request, function(response) { … });
HTTP POST
/api/v10/commerce.item-prices.update
{
  "prices" : [ { // prices for each item and price list to update
    "sku" : "A927TP", // item SKU (required) - string(1…40)
    "list" : 4, // price list (id) (required) - int(1…255)
    "price" : 54.120 // price (can be null) - decimal[10,3](0…)
  }, … ]
}

Response

{
  "status" : "ok"
}

Errors

Field Type Description
list InvalidValue Price list <list> is not base
list NotFound Price list <list> does not exist
prices Malformed A SKU is empty
prices Malformed There can be no more than 1000 items

item-prices.update-tiers

Updates the tier prices of one or more items and price lists.

Request

Admin SDK
Admin.api('commerce.item-prices.update-tiers', request, function(response) { … });
HTTP POST
/api/v10/commerce.item-prices.update-tiers
{
  "tierPrices" : [ { // tier prices for each item and price list to update
    "sku" : "A927TP", // item SKU - string(1…40)
    "list" : 4, // price list (id) - int(1…255)
    "prices" : { // price for each tier (can be null) - decimal[10,2](0…) -> decimal[10,3](0…)
        "1.00" : 56.335,
        "5.00" : 54.220,
        "10.00" : 51.950
    }
  }, … ]
}

Response

{
  "status" : "ok"
}

Errors

Field Type Description
list InvalidValue Price list <list> is not base
list NotFound Price list <list> does not exist
prices Malformed A price has not tiers
tierPrices Malformed A SKU is empty
tierPrices Malformed Item '<sku>' with list <list> is repeated
tierPrices Malformed There can be no more than 1000 items
updateTiers NotAvailable Price tiers are not available for this installation