Sample Scenario of Offer Creation


This section describes how to create a sample offer using Public API calls.

Offer details:

  • Create an Offer with a 2% Discount from the Total Amount of the Basket
  • Name: 2% Off from the Total Price
  • Description: 2% off from the total price for all items in the sale basket (1 or more items added to the basket).
  • Restrictions: no restrictions, all items, any day of the week.

Every offer in Vynamic Engage must be linked to a promotion while every promotion has to be linked to a campaign. Use the following endpoints:

StepsEndpoint
1. Create a campaign with promotionPOST /campaigns
2. Get the promotionId of the promotion belonging to your campaignGET /campaigns/{campaignId}/promotions
3. Create an offerPOST/ offers

1. Create a Campaign with Promotion - POST /campaigns

Request

Required Body Parameters

ParameterDescriptionSchema
nameCampaign name, for example: Campaign 1string
descriptionCampaign description, for example: First Campaignstring
startDateCampaign start date*, for example: 2024-11-30string
endDateCampaign end date*, for example: 2024-11-30string
promotions.namePromotion name, for example: Discountstring
promotions.descriptionPromotion description, for example: Discountstring
promotions.startDatePromotion start date*, for example: 2024-11-30string
promotions.endDatePromotion end date*, for example: 2025-12-31string

*Date format in the REST API is 'YYYY-MM-DD', for example '2024-11-30'.

Optional Body Parameters

ParameterDescriptionSchema
statusCampaign status. Possible values: Active, Inactive*string
promotions.statusPromotion status. Possible values: Active, Inactive*string

*if empty, the default value set in the VE backend system is active.

Sample request:

202: Response

Required Parameters:

ParameterDescriptionSchema
CampaignIdID of the created campaign (internal ID)integer (int32)
Optional Parameters:
ParameterDescriptionSchema
AccountIdCurrently, the Account ID always has value 1.integer (int32)
ResultResult of the action. The allowed values: ERROR, SUCCESSstring

Sample response:

2. Obtain the promotionId - GET /campaigns/{campaignId}/promotions

Required URI Parameter in the request:

ParameterDescriptionSchema
campaignIdUnique identifier of the campaign, use the CampaignId generated in the previous call.integer

Sample response:

3. Create an Offer with a 2% Discount from the Total Price - POST /offers

Offers are the main objects defined by the Marketing Service. They describe a set of conditions and benefits related to the purchase of specific products. When the conditions configured within the framework of the offer are met, its benefits are granted by the Discount Engine.

Request

Required Body Parameters

ParameterDescriptionSchema
campaignIdThe Campaign to which the offer is linkedinteger
promotionIdThe Promotion that contains the offer that will be created.integer
nameOffer name, in this case: 2% Off from the Total Pricestring
startDateThe first day of the offer validity period. The date should fall within the promotion duration period, anywhere from its start to its end date.string
endDateThe last day of the offer validity period. The date should fall within the promotion duration period, anywhere from its start to its end date.string
benefitDefinitionDefine what kind of benefit should be granted when offer is executed.object
benefitDefinition.typeType of the benefit. Allowed: Discount, LoyaltyPoints, Coupon, Stamp, Voucher, Messagestring
bestPriceSortingDefines the sorting performed by the Discount Engine in the background when deciding which items should be discounted.string
priorityDefines the order in which offers are applied. The benefit with the highest priority is calculated first.integer

calculationDefinition > quantityActions

ParameterDescriptionSchema
quantityNumber of items matching ItemsQualifier in the basketnumber
calculationTypeBenefit calculation type. The allowed values: Percent, Value, NewPricestring
calculationValueBenefit calculation value, in this example: 2 (2%)number
operatorThe allowed values: EveryNth, EveryGroupOfN, AllBelowOrEqual, AllAbove, Threshold, AllAboveOrEqualstring
itemsQualifierDefines the conditions for items that are part of the offer calculation.object
itemsQualifer.qualifierElements.qualifierTypeThe allowed values: PosItems, PosItemsExclusion, ItemGroups, ItemGroupsExclusion, Categories, CategoriesExclusion, Departments, DepartmentsExclusion, DepartmentGroups, DepartmentGroupsExclusion, AllItemsstring
countingTypeThe flag that determines how items are counted when the discount is triggered by a specific number of items. The allowed values: CountAll, GroupSameItems. The CountAll value means that the action is performed for any qualified item.string

Sample request:

Time Condition: The default value takes all days of the week from "00:00:00" to "23:59:59". The system sets the default value, if the value is not provided.

Sample response: