getCampaigns

Retrieve sales promotions.

This API call will return descriptions of promotion rules, which are generally structured as follows: "Customer must do/buy X and will get Y" (a discount, special price etc.)

For an API call that automatically implements all promotion rules and price lists automatically for you, see calculateShoppingCart.

To create a promotion rule, see saveCampaign.

In order to manage the new multi warehouse links, see getCampaignWarehouses.

Input parameters

Parameter name Description Possible value Required
campaignID Promotion ID. Use to retrieve one specific sales promotion. integer
campaignIDs Multiple promotion IDs, separated by commas, such as: 1,2,3,4,5. string
name Search for a promotion by name. Returns all promotions where beginning of the name matches. string
type "auto", "manual" or "coupon". See below for a description of each type. string
startDateFrom ISO date (yyyy-mm-dd)
startDateTo ISO date (yyyy-mm-dd)
endDateFrom ISO date (yyyy-mm-dd)
endDateTo ISO date (yyyy-mm-dd)
enabled 0 or 1. integer
activeToday Search for promotions which are active today (ie. which do not have any date restrictions, or the date range of which includes today's date). The promotion has to be "enabled" for it to be active. Integer (0 or 1)
warehouseID

Warehouse ID. Search for promotions that apply in this location.

The response includes promotions that have been set up specifically for this store, as well as promotions that do not have any restrictions and which apply to all stores.

There are five different ways to restrict the scope of a promotion:

  • one single location (field "Promotion only takes place in this store" on the old promotion form)
  • multiple locations (field "Promotion only applies in stores" on the new promotion form)
  • multiple store regions (both old and new forms)
  • group of stores (on the old promotion form)
  • check box "Promotion is inactive if no stores have been selected" (on the new promotion form)

This filter does not check all five: the "multiple store regions" restriction and the "multiple locations" restriction are skipped for better performance. Effectively, it means that the filter might return more promotions than expected, including some which have been configured to apply only in certain other store regions.

(The calculateShoppingCart call, in contrast, will respect all restrictions and will not ignore any.)

integer
getStoreSpecificPromotionsForWarehouseID

Warehouse ID. Search for promotions that apply in this location.

This filter checks two restrictions:

  • one single location (field "Promotion only takes place in this store" on the old promotion form)
  • multiple locations (field "Promotion only applies in stores" on the new promotion form)

To manage multiple locations, see getCampaignWarehouses, saveCampaignWarehouse and removeCampaignWarehouse.

integer
tierID Search promotions connected to defined tier. Use 0 to show promotions without tiers. Tiers specify order of promotion applying and ability to disable promotions with manual discount reason codes. integer
storeRegionIDs

Search for promotions that are associated with this specific region. (This will NOT return promotions that do not have any region restriction, ie. which are configured to apply in all stores.)

A comma-separated list of store region IDs.

Using this field will return error 1028 if "Store regions" and "Promotion regions" modules are not enabled on this account.

String (comma-separated list of integers)
customerGroupIDs

Search for promotions that are associated with this specific customer group. (This will NOT return promotions that do not have any restrictions by customer group, ie. which are configured to apply to all customer groups.)

A comma-separated list of customer group IDs.

Using this field will return error 1028 if "Promotion regions" module is not enabled on this account.

String (comma-separated list of integers)
reasonID Search for promotions that are associated with this specific reason code. integer
isHQPromotion 0 or 1. integer
searchAttributeName Name of attribute to search from. Both "searchAttributeName" and "searchAttributeValue" have to be specified. Error 1030 will be returned if value is an array. string
searchAttributeValue Attribute value to search for. Error 1030 will be returned if value is an array. string
changedSince Retrieve only items that have been added or modified since the specified timestamp. Use it to keep a local database in sync with Erply. Integer (Unix timestamp)
recordsOnPage Number of records API should return. By default 20, at most 100. integer
pageNo API returns at most recordsOnPage items at a time. To retrieve the next recordsOnPage items, send a new request with pageNo incremented by one. By default, API returns "page 1". integer
lang Retrieve item names in a specific language. If omitted, API will return item names in the default language of your Erply account.
Possible values:
  • 'eng' - English
  • 'spa' - Spanish
  • 'ger' - German
  • 'swe' - Swedish
  • 'fin' - Finnish
  • 'rus' - Russian
  • 'est' - Estonian
  • 'lat' - Latvian
  • 'lit' - Lithuanian
  • 'gre' - Greek
string
orderBy 'name', 'startDate', 'endDate', 'enabled', 'reasonID'. By default 'campaignID'.
orderByDir Sort direction: 'asc' (ascending order) or 'desc' (descending order). By default, items are sorted in ascending order. string

Response

Field name Type Description
campaignID integer
startDate string Format: yyyy-mm-dd. Promotion start date.
endDate string Format: yyyy-mm-dd. Promotion end date.
startTime ISO time (hh:mm:ss) Promotion start time.
endTime ISO time (hh:mm:ss) Promotion end time.
name string
type String (6) Describes the way promotion is applied. Possible values:
  • auto - Promotion is applied automatically to all customers, based on rules below. No coupons needed.
  • manual - Cashier selects the promotion manually. (Cashier must have relevant rights - getUserRights must return rightApplyPromotions = 1)
  • coupon - Promotion is applied when user hands in a printed coupon with a serial number.
formula string

Indicates the general "pattern" of the promotion. Based on what is the requirement and what is the award, all promotions can be organized into these 11 categories. This is a derived field, generated from the more specific properties listed below. One of the following:

  • BUNDLE_PRICE
  • SPECIAL_PRICE_WITH_BULK_PURCHASE
  • DISCOUNT_WITH_BULK_PURCHASE
  • BUY_ONE_GET_ONE
  • BUY_AND_GET_PERCENTAGE_OFF_EVERYTHING
  • BUY_AND_GET_SUM_OFF_YOUR_PURCHASE
  • SPEND_AND_GET
  • SPEND_AND_GET_PERCENTAGE_OFF_EVERYTHING
  • SPEND_AND_GET_SUM_OFF_YOUR_PURCHASE
  • PAY_WITH_LOYALTY_POINTS
  • GET_DISCOUNT_FOR_LOYALTY_POINTS
warehouseIDs string

A comma-separated list of location IDs where the promotion applies.

This is a derived field. The list is combined from three separate settings:

  • Field "Promotion only takes place in this store" on the old promotion form (one single location)
  • Field "Promotion only applies in stores" on the new promotion form (multiple locations)
  • Field "Or in this group of stores" on the old promotion form (a group of stores that can contain multiple locations)

If this list is empty, it means that the promotion has been configured for specific store regions (see field storeRegions), or that it does not currently apply anywhere (if field restrictOnNoWarehouses has a value of 1), or otherwise, that it applies to all locations.

warehouseID integer

A compatibility field for old integrations that do not expect a promotion to be available in multiple locations.

This is just the first entry from the comma-separated list warehouseIDs, explained above.

To manage multiple locations (field "Promotion only applies in stores" on the new promotion form) use getCampaignWarehouses, saveCampaignWarehouse and removeCampaignWarehouse.

tierID integer Promotion tier ID. Tiers specify order of promotion applying and ability to disable promotions with manual discount reason codes.
storeGroup string

If this field has a value, the promotion is available only in a specific store group.

"Store group" is a text field on location form.

storeRegions array

If this list contains any elements, then promotion is available only in specific store regions.

Each list element contains the following fields:

Field nameTypeDescription
idIntegerStore region ID
customerGroups array

If this list contains any elements, then promotion will apply only to these customer groups.

Each list element contains the following fields:

Field nameTypeDescription
idIntegerCustomer group ID
canBeAppliedManuallyMultipleTimes Integer (0 or 1) Indicates that it is possible to apply this promotion manually multiple times.

This depends on the structure of the promotion. Some kinds of promotions support multiple application; for others it is not supported or it would not make sense. The flag is always 0 for non-manual (automatic or coupon-activated) promotions, for one-time promotions and one-time birthday promotions.
subsidy number Available only if Price list row subsidy and other fields module is enabled on your account.
subsidyValue number DEPRECATED — subsidy is recommended instead. Available only if Price list row subsidy and other fields module is enabled on your account.
subsidyTypeID integer Available only if Price list row subsidy and other fields module is enabled on your account.
page integer Available only if Price list row subsidy and other fields module is enabled on your account.
positionOnPage integer Available only if Price list row subsidy and other fields module is enabled on your account.
forecastUnits integer Available only if Price list row subsidy and other fields module is enabled on your account.
*** ** A promotion may have one of the following requirements:
  1. The customer must make a purchase with a total value of $X.XX (purchaseTotalValue)

  2. The customer must buy at least a certain number of items (purchasedAmount) from a list of product groups (purchasedProductGroupIDs)

  3. The customer must buy at least a certain number of items (purchasedAmount) from a list of product categories (purchasedProductCategoryIDs)

  4. The customer must buy at least a certain number of items (purchasedAmount) from a list of brands (purchasedBrandIDs)

  5. The customer must buy at least a certain number of items (purchasedAmount) from a list of products (purchasedProducts)

  6. The customer must redeem a specified number of loyalty points (rewardPoints)
A promotion rule will not contain two or more requirements simultaneously.

If the specified condition is met, customer becomes eligible for the promotional offer.
purchaseTotalValue number
purchaseTotalValueMax number
purchasedProductGroupID integer Ignore this field; it is only kept for compatibility. See "purchasedProductGroupIDs" instead. There can be multiple product groups. If a promotion has been created with multiple product groups, this field will return just the first one from the list.
purchasedProductCategoryID integer Ignore this field; it is only kept for compatibility. See "purchasedProductCategoryIDs" instead. There can be multiple product categories. If a promotion has been created with multiple product categories, this field will return just the first one from the list.
purchasedProductGroupIDs array Array of purchased product group IDs.
purchasedProductCategoryIDs array Array of purchased product category IDs.
purchasedBrandIDs array Array of purchased brand IDs.
purchasedProducts array Each array element contains an integer field "productID". If "Price list row subsidy and other fields" module is enabled on your account, it will additionally contain a decimal field "subsidy".
purchasedAmount integer
rewardPoints integer
requiredCouponID integer If this field is set, then the promotion rule does not apply automatically, but only when customer hands in a particular coupon.
requiredCouponCode string Code of the aforementioned coupon.
priceAtLeast number If this field more than zero the customer must buy a certain number of items with item price more or equal to this value, doesnt work with total value or reward points.
priceAtMost number If this field more than zero the customer must buy a certain number of items with item price more or equal to this value, doesnt work with total value or reward points.
requiresManagerOverride integer If set to 1, indicates that this is a manual promotion that can be applied to a sale with store manager's approval only. API client (POS) must implement the approval process itself; it is not enforced by API.
negativePricesAllowed Integer (0 or 1)
*** ** A promotion may give one of the following discounts/awards:
  1. The customer gets X% off the entire purchase (percentageOffEntirePurchase)

  2. The customer gets $X.XX off the entire purchase (sumOffEntirePurchase). Note that Erply invoice model does not have a concept of applying a discount sum to the whole invoice. This sum needs to be more-or-less evenly, or proportionally, divided between invoice rows.

  3. The customer gets bought items (purchasedAmount pcs of purchasedProducts) for a specific total price (specialPrice). Such a promotion may be called "Buy Two For $5".

  4. The customer gets a certain sum off (sumOFF), or a discount % off (percentageOFF) of one (awardedAmount = 1), multiple (awardedAmount = n) or infinite (awardedAmount = 0) items:

    1. from a list of product groups (awardedProductGroupIDs)
    2. from a list of product categories (awardedProductCategoryIDs)
    3. from a particular list of brands (awardedBrandIDs)
    4. from a particular list of products (awardedProducts)
    5. with a price equal to or lower than any items specified above (lowestPriceItemIsAwarded).


  5. The customer gets a % discount on any one chosen receipt line (discountForOneLine)

  6. The customer gets a certain sum (sumOffMatchingItems), or a discount % (percentageOffMatchingItems) off the items that were required for the promotion (purchasedProducts / purchasedProductGroupID / purchasedProductCategoryID / purchasedProductGroupIDs / purchasedProductCategoryIDs / purchasedBrandIDs), and also of each subsequent similar item.

  7. The customer gets bought items (purchasedAmount pcs of purchasedProducts) for a special discounted price (specialUnitPrice). The promotion can have a maximum limit how many items get the discount(maxItemsWithSpecialUnitPrice).
A promotion rule will not contain two or more awards simultaneously.
percentageOffEntirePurchase number This promotion gives a percentage discount on the entire sale.
excludeDiscountedFromPercentageOffEntirePurchase Integer (0 or 1)

This flag applies to promotions "% off entire sale", so you should inspect it only if percentageOffEntirePurchase contains a non-zero value.

Indicates that the promotion should not apply to items that have already received any discount from a price list, a manual discount by the cashier, or a discount from any preceding promotion (both item-level and invoice-level promotions).

excludePromotionItemsFromPercentageOffEntirePurchase Integer (0 or 1)

This flag applies to promotions "% off entire sale", so you should inspect it only if percentageOffEntirePurchase contains a non-zero value.

Indicates that the promotion should not apply to items that have already received a promotion discount (item-level promotions), or have triggered a promotion.

percentageOffExcludedProducts array A further restriction for the "% off entire sale" promotion. IDs of products to which the discount percentage should not be applied.
percentageOffIncludedProducts array A further restriction for the "% off entire sale" promotion. IDs of the only allowed products to which the discount percentage may be applied, at all. (All other products in the basket should be left unaffected by this promotion.)
sumOffEntirePurchase number
percentageOffMatchingItems integer
sumOffMatchingItems number
maximumNumberOfMatchingItems integer Maximum limit how many items get the discount.
sumOffExcludedProducts array Each array element contains an integer productID attribute.
sumOffIncludedProducts array Each array element contains an integer productID attribute.
specialPrice number
awardedProductGroupID integer Ignore this field; it is only kept for compatibility. See "awardedProductGroupIDs" instead. There can be multiple discounted product groups in a promotion. If a promotion discounts multiple product groups, this field will return just the first one from the list.
awardedProductCategoryID integer Ignore this field; it is only kept for compatibility. See "awardedProductCategoryIDs" instead. There can be multiple discounted product categories in a promotion. If a promotion discounts multiple product categories, this field will return just the first one from the list.
awardedProductGroupIDs array Array of awarded product group IDs.
awardedProductCategoryIDs array Array of awarded product category IDs.
awardedBrandIDs array Array of awarded brand IDs.
awardedProducts array Each array element contains an integer field "productID". If "Price list row subsidy and other fields" module is enabled on your account, it will additionally contain a decimal field "subsidy".
awardedAmount integer In promotion "% or $ off of specific products", how many items should get the discount. Fulfilling the promotion conditions may entitle the customer to one discounted item (awardedAmount = 1), or at most N discounted items (awardedAmount > 1), or an unlimited number of items (awardedAmount = 0). The "unlimited" option may be used in promotions such as "First item costs $3, subsequent ones are $2 each".
excludedProducts array Each array element contains an integer productID attribute.
reasonID integer Reason Code ID that is associated with this promotion.
lowestPriceItemIsAwarded integer 0 or 1
highestPriceItemIsAwarded integer 0 or 1
percentageOFF Decimal
discountForOneLine Decimal
enabled integer Possible values: 0 or 1.
sumOFF Decimal
maximumPointsDiscount number This setting only applies to promotions that look like "Get $1 of discount for 1 loyalty point". This setting makes sure that regardless of the number of points the customer has, the points can only be exchanged for a limited amount of discount (a specified % of invoice total).
customerCanUseOnlyOnce integer 0 or 1
isBirthdayPromotion integer 0 or 1
oncePerBirthday integer 0 or 1
oncePerDay integer 0 or 1
onlyForDiscountedItems integer 0 or 1
restrictOnNoWarehouses integer How the state where no warehouses are connected to the promotion is handled. When enabled then a promotion without any warehouses will not be applied anywhere. 0 or 1
specialUnitPrice number New unit price.
maxItemsWithSpecialUnitPrice integer Maximum limit how many items can be purchased with this special unit price.
redemptionLimit integer Maximum limit how many times the promotion can be applied to one sale.
isStackable integer 0 or 1
isHQPromotion integer 0 or 1
added integer Unix timestamp. Creation time.
lastModified integer Unix timestamp. Last modification time.
attributes array Additional attributes. Each item looks like this:

Field nameTypeDescription
attributeNameStringAttribute name
attributeTypeStringAttribute type
attributeValueStringAttribute value