savePriceList

Create a price list, or add prices to an existing price list.

A price list can contain three types of rules: 1) fixed prices for specified products, 2) fixed prices for specified services, 3) percentage discounts for product groups. You may specify as many rules of each type as necessary.

If you need to create a very large price list (with thousands of items), we strongly recommend to create it in parts — create the list itself with the first API call, and then add items into the list with each subsequent call, eg. in batches of 1000.

If needed, you can edit just an existing price list's name, status and validity dates. In that case, API will not modify price list contents. However, you can also use this call for adding or updating prices in an existing price list. If you send any price list rules, API will check if the specified product or product group already exists in price list. If yes, that price list item will be updated. If not, a new one will be added.

If you want to remove any items from the price list, use the removeItemsFromPriceList or the deleteProductInPriceList API call.

It is also possible to add new items to the price list with the addProductToPriceList API call or edit a single rule with the editProductInPriceList API call.

If you have the Quantity Discounts module enabled, please note that each product may have multiple entries in the price list. If you want to address and update one specific rule, you also need to pass along the "amount" parameter.

Input parameters

Parameter name Description Possible value Required
pricelistID Price list ID.
If this parameter is present the specified price list will be updated.
integer
name Price list name. Use either general parameter "name" or one or more of the following parameters if you need to set the names in specific languages. To have multilingual names enabled, please contact our customer support. An error will be returned if you attempt to set a name in a specific language and the multilingual names are not enabled on your account. string
nameENG string
nameSPA string
nameGER string
nameSWE string
nameFIN string
nameRUS string
nameEST string
nameLAT string
nameLIT string
nameGRE string
startDate string Valid From date. ISO date (yyyy-mm-dd).
endDate string Valid Until date. ISO date (yyyy-mm-dd).
active Setting this field to 1 activates the price list, setting it to 0 disables it. 0 or 1
type

Price list type. Possible types are 'BASE_PRICE_LIST', 'STORE_PRICE_LIST'. Certain customers have additional, custom price list types, too; please refer to private documentation on those.

To use this field, you need to have the "Price list types" extra module. Please contact customer support to have it activated on your account.

If you attempt to use this field and the extra module has not been enabled, API will return error code 1006.

If the "Price list types" module has been enabled, this is a required field.

An invalid type will return error 1016. Error 1016 will also be returned if you attempt to create or edit a price list with any other type than "STORE_PRICE_LIST" and you do not have rights for that.

string
***** Price list rules. Each rule consists of a set of parameters. The "#" in parameter names denotes rule number. When preparing input parameters for this API call, please give a sequential number (1, 2, 3, ...) to each rule you send.

For example, to add one product price and one product group discount to the price list, you probably need to send parameters:
  • type1 = "PRODUCT", id1 = product ID, price1 = product price,
  • type2 = "PRODGROUP", id2 = product group ID, discountPercent2 = discount percentage

When updating an existing price list, API will only update the rules specified in input data and leave all other existing rules unchanged. You cannot use savePriceList to delete a rule. For that purpose, see API call removeItemsFromPricelist instead.
type# Possible types are 'PRODUCT', 'PRODGROUP' or 'SERVICE'. string yes
id# Product, or product group ID, depending on rule type integer yes
price# Discounted sales price for a product. (For products only.) Required field for products. Decimal
discountPercent# Discount % for a product group (For product groups only). Decimal
amount# Available only if Quantity discounts module is enabled on your account. The quantity threshold from which the specified price will apply. integer
***** Additional attributes associated with this item.
Attributes must be supplied as a flat list, each attribute defined by the following set of three parameters. Replace # with set number (1, 2, 3, ...).

When updating an existing entry, API will only update the attributes specified in input data and leave all other existing attributes unchanged. To delete an attribute, set its value to 'null' or 'undefined'.
attributeName# Attribute name. Name can only contain the following symbols: A-Z, a-z, 0-9, dash and underscore. string
attributeType# Attribute type, possible types are 'text', 'int' and 'double'. By default 'text'. string
attributeValue# Value of the attribute. Set value to 'null' or 'undefined' to delete an attribute.
'text' attribute can be any string, maximum 255 characters.
'int' must be a signed 32-bit integer.
'double' must be a decimal number.
string
***** End of attribute fields

Response

Field name Type Description
pricelistID integer ID of the newly-created item
itemsNotAddedToPriceList array Array elements have the following attributes:
  • type - String - Item type
  • id - Integer - Item ID