Open2b versione 7.5

price-lists

price-lists.find

Returns the price lists that meet the given conditions.

Request

Admin SDK
Admin.api('commerce.price-lists.find', request, function(response) { … });
HTTP POST
/api/v10/commerce.price-lists.find
{
  "conditions" : { // returns only the price lists …
    "isDerived" : false, // … that are derived or not - bool
    "after" : 5 // … with identifier after this value - int(0…)
  },
  "fields" : [ "id", "code", … ], // fields to return - string
  "order" : [ "name" ], // sort order of returned price lists, can contain "id", "-id", "code", "-code", name", "-name",
                        // "base", "-base", "factor", "-factor"
  "limit" : 10, // maximum number of price lists to return - int(1…255)
  "first" : 30 // index of the first price list to return - int(0…255)
}

Response

{
  "status" : "ok",
  "priceLists" : [ {
    "id" : 3, // identifier - int(1…255)
    "code" : "SALE", // code - string(0…40)
    "name" : "Sale", // name - string(0…120)
    "base" : 1, // base price list (id) (can be null) - int(1…255)
    "factor" : 1.55 // base price factor (can be null) - decimal[5,4](0…10)
  }, … ]
}

price-lists.get

Returns a price list given its identifier.

Request

Admin SDK
Admin.api('commerce.price-lists.get', request, function(response) { … });
HTTP POST
/api/v10/commerce.price-lists.get
{
  "id" : 3, // identifier of the price list to return (required) - int(1…255)
  "fields" : [ "id", "code", … ] // fields to return - string
}

Response

{
  "status" : "ok",
  "priceList" : {
    "id" : 3, // identifier - int(1…255)
    "code" : "SALE", // code - string(0…40)
    "name" : "Sale", // name - string(0…120)
    "base" : 1, // base price list (id) (can be null) - int(1…255)
    "factor" : 1.55 // base price factor (can be null) - decimal[5,4](0…10)
  }
}

price-lists.count

Total number of price lists.

Request

Admin SDK
Admin.api('commerce.price-lists.count', request, function(response) { … });
HTTP POST
/api/v10/commerce.price-lists.count
{
  "conditions" : { // counts only the price lists …
    "isDerived" : false, // … that are derived or not - bool
    "after" : 5 // … with identifier after this value - int(0…)
  }
}

Response

{
  "status" : "ok",
  "count" : 5 // number of price lists - int(0…255)
}

price-lists.create

Create a new price list.

Request

Admin SDK
Admin.api('commerce.price-lists.create', request, function(response) { … });
HTTP POST
/api/v10/commerce.price-lists.create
{
  "priceList" : { // price list to create (required)
    "code" : "SALE", // code - string(0…40)
    "name" : "Sale", // name - string(0…60)
    "base" : 1, // base price list (id) (can be null) - int(1…255)
    "factor" : 1.55 // base price factor (can be null) - decimal[5,4](0…10)
  }
}

Response

{
  "status" : "ok",
  "id" : 2 // identifier of the new price list - int(1…255)
}

Errors

Field Type Description
base InvalidValue Price list <base> is not base
base NotFound Price list <base> does not exist
code AlreadyExists Code '<code>' already exists
code Malformed '<code>' has trailing spaces
factor InvalidValue Factor of base price lists cannot be defined
factor InvalidValue Factor of derived price lists cannot be null
priceList LimitReached Maximum limit of price lists has been reached

price-lists.update

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

Request

Admin SDK
Admin.api('commerce.price-lists.update', request, function(response) { … });
HTTP POST
/api/v10/commerce.price-lists.update
{
  "id" : 2, // identifier of the price list to update (required)
  "priceList" : { // price list's fields to update (required)
    "code" : "SALE", // code - string(0…40)
    "name" : "Sale", // name - string(0…60)
    "base" : 1, // base price list (id) (can be null) - int(1…255)
    "factor" : 1.55 // base price factor (can be null) - decimal[5,4](0…10)
  }
}

Response

{
  "status" : "ok"
}

Errors

Field Type Description
base InvalidValue Base of base price lists cannot be defined
base InvalidValue Base of derived price lists cannot be null
base InvalidValue Price list <base> is not base
base NotFound Price list <base> does not exist
code AlreadyExists Code '<code>' already exists
code Malformed '<code>' has trailing spaces
factor InvalidValue Factor of base price lists cannot be defined
factor InvalidValue Factor of derived price lists cannot be null
id NotFound Price list <id> does not exist

price-lists.delete

Deletes one or more price lists.

Request

Admin SDK
Admin.api('commerce.price-lists.delete', request, function(response) { … });
HTTP POST
/api/v10/commerce.price-lists.delete
{
  "ids" : [ 2, 5, … ] // identifiers of the price lists to delete (required) - int(1…255)
}

Response

{
  "status" : "ok"
}

Errors

Field Type Description
ids InvalidValue Price list <id> is base for price list <priceList>
ids InvalidValue Price list <id> is used by customer group <group>