createPromotion
post
/ccadmin/v1/promotions
Create Promotion. Create a new promotion. **Requires the x-ccasset-language header so translated content can be set for a specific language.**
Request
Supported Media Types
- application/json
Header Parameters
- X-CCAsset-Language
-
Type:
stringRequired:trueThe asset language of the request
Body Parameter
Root Schema : createPromotion_request
{
"endDate":"2014-04-29T19:30:00.000-04:00",
"displayName":"10% Off Orders Over $100 ",
"templateValues":{
"spend_value":"100",
"discount_value":"10",
"discount_type_value":"percentOff"
},
"description":"Spend $100 today and get 10% off your order!",
"sites":[
{
"repositoryId":"funSite"
},
{
"repositoryId":"anotherFunSite"
}
],
"priority":1,
"templatePath":"order",
"enabled":true,
"cardIINRanges":[
"456789",
"9878",
"987634-987648"
],
"excludedPromotions":[
{
"repositoryId":"explicitItemFixedDiscount"
},
{
"repositoryId":"bogoPromotion"
}
],
"parentFolder":{
"repositoryId":"promoFolder100001"
},
"templateName":"spendYGetOrderDiscount",
"audiences":[
{
"repositoryId":"audienceId1"
},
{
"repositoryId":"audienceId2"
}
],
"startDate":"2014-04-25T17:30:00.000-04:00",
"shippingMethods":[
"priorityShippingMethod",
"groundShippingMethod"
]
}
- audiences
-
Type:
arrayaudiencesAdditional Properties Allowed:List of audiences to which the promotion is limited. An empty list implies no restrictions. - cardIINRanges
-
Type:
arraycardIINRangesAdditional Properties Allowed:List of issuer identification numbers including wildcards and ranges for which the promotion should be applied. - description
-
Type:
stringThe description of the promotion. - displayName
-
Type:
stringRequired:trueThe display name of the promotion. - enabled
-
Type:
booleanWhether or not the promotion is currently enabled. - endDate
-
Type:
stringWhen this promotion ceases to be active - excludedPromotions
-
Type:
arrayexcludedPromotionsAdditional Properties Allowed:List of promotions to be excluded from the current promotion. Item promotions can exclude promotions of type: item, order, shipping. Order promotions can exclude promotion of type order and shipping. Shipping promotions can only exclude another shipping promotions. - parentFolder
-
Type:
objectparentFolderAdditional Properties Allowed:Map of promotion folder's repository ID key and value. In order to have no folder assignment, set parentFolder to null e.g. "parentFolder": null or skip the property completely. - priceListGroups
-
Type:
arraypriceListGroupsAdditional Properties Allowed:The price List Groups - priority
-
Type:
stringRequired:trueThe priority of this promotion over other promotions - shippingMethods
-
Type:
arrayshippingMethodsAdditional Properties Allowed:Shipping Methods for which the promotion should be applied - sites
-
Type:
arraysitesAdditional Properties Allowed:This will limit the promotion to being applicable only to the 1+ specified sites. An empty array means the promotion applies to all sites. - startDate
-
Type:
stringWhen this promotion becomes active - templateName
-
Type:
stringRequired:trueThe name of the promotion template to use. - templatePath
-
Type:
stringRequired:trueThe path to the promotion template. - templateValues
-
Type:
objecttemplateValuesAdditional Properties Allowed:Specifies the template values that are used as part of the promotion to control its behavior
Nested Schema : audiences
Nested Schema : cardIINRanges
Type:
arrayList of issuer identification numbers including wildcards and ranges for which the promotion should be applied.
-
Type:
string
Nested Schema : excludedPromotions
Type:
arrayList of promotions to be excluded from the current promotion. Item promotions can exclude promotions of type: item, order, shipping. Order promotions can exclude promotion of type order and shipping. Shipping promotions can only exclude another shipping promotions.
Nested Schema : parentFolder
Type:
objectMap of promotion folder's repository ID key and value. In order to have no folder assignment, set parentFolder to null e.g. "parentFolder": null or skip the property completely.
- repositoryId
-
Type:
stringExisting promotion folder's repository ID
Nested Schema : priceListGroups
Nested Schema : shippingMethods
Nested Schema : sites
Nested Schema : templateValues
Type:
objectSpecifies the template values that are used as part of the promotion to control its behavior
- condition_psc_value
-
Type:
objectcondition_psc_valueAdditional Properties Allowed:The condition product set criteria value - discount_type_value
-
Type:
stringThe discount type - discount_value
-
Type:
stringThe discount value - discountStructure
-
Type:
objectdiscountStructureAdditional Properties Allowed:The discount structure - gwpItem
-
Type:
objectgwpItemAdditional Properties Allowed:The gift with promotion configuration details - no_of_items_to_buy
-
Type:
stringThe number of items to buy - no_of_items_to_discount
-
Type:
stringThe number of items to discount - offer_psc_value
-
Type:
objectoffer_psc_valueAdditional Properties Allowed:The offer product set criteria values - optional_offer_psc_value
-
Type:
objectoptional_offer_psc_valueAdditional Properties Allowed:The offer product set criteria values - PSC_value
-
Type:
objectPSC_valueAdditional Properties Allowed:The product set criteria values - sort_by
-
Type:
stringThe sort by condition - sort_order
-
Type:
stringThe sort order - spend_value
-
Type:
stringThe spend value
Nested Schema : items
Type:
object- repositoryId
-
Type:
stringRequired:trueThe ID of an audience associated with the promotion.
Nested Schema : items
Type:
object- repositoryId
-
Type:
stringRequired:trueThe promotion's repository ID
Nested Schema : items
Type:
object- repositoryId
-
Type:
stringRequired:trueThe ID of a site associated with the promotion.
Nested Schema : condition_psc_value
Type:
objectThe condition product set criteria value
- excludedCategories
-
Type:
arrayexcludedCategoriesAdditional Properties Allowed:The excluded categories - excludedProducts
-
Type:
arrayexcludedProductsAdditional Properties Allowed:The excluded products - includedCategories
-
Type:
arrayincludedCategoriesAdditional Properties Allowed:The included categories - includedProducts
-
Type:
arrayincludedProductsAdditional Properties Allowed:The included products
Nested Schema : discountStructure
Type:
objectThe discount structure
- discount_details
-
Type:
arraydiscount_detailsAdditional Properties Allowed:The discount details - discount_type_value
-
Type:
stringThe discount type value
Nested Schema : gwpItem
Type:
objectThe gift with promotion configuration details
- autoRemove
-
Type:
booleanWhether to remove item from cart when cart no longer meets buy condition - giftId
-
Type:
stringThe product id of the gift item - giftType
-
Type:
stringThe gift item type
Nested Schema : offer_psc_value
Type:
objectThe offer product set criteria values
- excludedCategories
-
Type:
arrayexcludedCategoriesAdditional Properties Allowed:The excluded categories - excludedProducts
-
Type:
arrayexcludedProductsAdditional Properties Allowed:The excluded products - includedCategories
-
Type:
arrayincludedCategoriesAdditional Properties Allowed:The included categories - includedProducts
-
Type:
arrayincludedProductsAdditional Properties Allowed:The included products
Nested Schema : optional_offer_psc_value
Type:
objectThe offer product set criteria values
- excludedCategories
-
Type:
arrayexcludedCategoriesAdditional Properties Allowed:The excluded categories - excludedProducts
-
Type:
arrayexcludedProductsAdditional Properties Allowed:The excluded products - includedCategories
-
Type:
arrayincludedCategoriesAdditional Properties Allowed:The included categories - includedProducts
-
Type:
arrayincludedProductsAdditional Properties Allowed:The included products - sameAsCondition
-
Type:
booleanItems to include and exclude for offer are the same as items in buy condition
Nested Schema : PSC_value
Type:
objectThe product set criteria values
- excludedCategories
-
Type:
arrayexcludedCategoriesAdditional Properties Allowed:The excluded categories - excludedProducts
-
Type:
arrayexcludedProductsAdditional Properties Allowed:The excluded products - includedCategories
-
Type:
arrayincludedCategoriesAdditional Properties Allowed:The included categories - includedProducts
-
Type:
arrayincludedProductsAdditional Properties Allowed:The included products
Nested Schema : excludedCategories
Nested Schema : excludedProducts
Nested Schema : includedCategories
Nested Schema : includedProducts
Nested Schema : discount_details
Nested Schema : items
Type:
object- discount_value
-
Type:
stringThe discount value - spend_value
-
Type:
stringThe spend value
Nested Schema : excludedCategories
Nested Schema : excludedProducts
Nested Schema : includedCategories
Nested Schema : includedProducts
Nested Schema : excludedCategories
Nested Schema : excludedProducts
Nested Schema : includedCategories
Nested Schema : includedProducts
Nested Schema : excludedCategories
Nested Schema : excludedProducts
Nested Schema : includedCategories
Nested Schema : includedProducts
Response
Supported Media Types
- application/json
200 Response
Following model is returned when operation succeeds.
Body
Root Schema : createPromotion_response
- cardIINRanges
-
Type:
arraycardIINRangesAdditional Properties Allowed:List of issuer identification numbers including wildcards and ranges for which the promotion should be applied. - displayName
-
Type:
stringThe display name of the promotion. - enabled
-
Type:
booleanWhether or not the promotion is currently enabled. - endDate
-
Type:
stringWhen this promotion ceases to be active - id
-
Type:
stringThe Promotion id. - lastModified
-
Type:
stringWhen promotion was last modified - parentFolder
-
Type:
objectparentFolderAdditional Properties Allowed:Map of promotion folder's repository ID key and value. - repositoryId
-
Type:
stringThe Promotion id. - sites
-
Type:
arraysitesAdditional Properties Allowed:This will limit the promotion to being applicable only to the 1+ specified sites. An empty array means the promotion applies to all sites. - stackingRule
-
Type:
objectstackingRuleAdditional Properties Allowed:Represents a rule to determine a group of promotions that can be used together. - startDate
-
Type:
stringWhen this promotion becomes active - type
-
Type:
integerInteger representation of the promotion type (shipping, item, order).
Nested Schema : cardIINRanges
Type:
arrayList of issuer identification numbers including wildcards and ranges for which the promotion should be applied.
-
Type:
string
Nested Schema : parentFolder
Type:
objectMap of promotion folder's repository ID key and value.
- repositoryId
-
Type:
stringThe promotion folder's repository ID that the promotion is assigned to.
Nested Schema : sites
Nested Schema : stackingRule
Type:
objectRepresents a rule to determine a group of promotions that can be used together.
- displayName
-
Type:
stringThe name of the rule. - id
-
Type:
stringThe stacking rule id. - maxPromotions
-
Type:
stringThe maximum number of promotions that can be applied to an order based on this rule. - repositoryId
-
Type:
stringThe stacking rule id
Nested Schema : items
Type:
object- repositoryId
-
Type:
stringThe ID of a site associated with the promotion.
Example application/json
{
"parentFolder":null,
"displayName":"10% Off Orders Over $100 ",
"id":"promo20014",
"type":9,
"enabled":true,
"cardIINRanges":[
"456789",
"9878",
"987634-987648"
]
}
Default Response
The error response.
The following are the internal error codes thrown by this API when the request processing fails in Oracle Commerce Cloud:
|Error Code|Description|
|------------------|------------------|
|21247|Invalid format for parentFolder property|
|21244|No item found for the following type and ID: promotionFolder,invalidId|
|21110|Invalid data error. The exact error message will vary based on the property.|
|21174|incompatiblePromotionId : Promotion type item can not be included/excluded with the given promotion type : {item/order or discount}.|
|21171|No item found for the following type and ID: promotion, invalidPromotion.|
Body
Root Schema : errorModel
Type:
object- devMessage
-
Type:
stringAn optional non-localized message containing technical information for developers - errorCode
-
Type:
stringThe numerical code identifying the error - errors
-
Type:
arrayerrorsAdditional Properties Allowed:An optional list of errors if multiple errors were encountered - message
-
Type:
stringThe localized message describing the error - moreInfo
-
Type:
stringAn optional non-localized message with more information - o:errorPath
-
Type:
stringAn optional machine readable description of where the error occurred - status
-
Type:
stringThe HTTP status code - type
-
Type:
stringThe URI to the HTTP state code definition
Nested Schema : errors
Nested Schema : items
Type:
object- devMessage
-
Type:
stringAn optional non-localized message containing technical information for developers - errorCode
-
Type:
stringThe numerical code identifying the error - message
-
Type:
stringThe localized message describing the error - moreInfo
-
Type:
stringAn optional non-localized message with more information - o:errorPath
-
Type:
stringAn optional machine readable description of where the error occurred - status
-
Type:
stringThe HTTP status code
Examples
Sample Request:
{
"endDate": "2014-04-29T19:30:00.000-04:00",
"displayName": "10% Off Orders Over $100 ",
"templateValues": {
"spend_value": "100",
"discount_value": "10",
"discount_type_value": "percentOff"
},
"description": "Spend $100 today and get 10% off your order!",
"sites": [
{"repositoryId": "funSite"},
{"repositoryId": "anotherFunSite"}
],
"priority": 1,
"templatePath": "order",
"enabled": true,
"cardIINRanges": [
"456789",
"9878",
"987634-987648"
],
"excludedPromotions": [
{"repositoryId": "explicitItemFixedDiscount"},
{"repositoryId": "bogoPromotion"}
],
"parentFolder": {"repositoryId": "promoFolder100001"},
"templateName": "spendYGetOrderDiscount",
"audiences": [
{"repositoryId": "audienceId1"},
{"repositoryId": "audienceId2"}
],
"startDate": "2014-04-25T17:30:00.000-04:00",
"shippingMethods": [
"priorityShippingMethod",
"groundShippingMethod"
]
}
Sample Response Payload returned by endpoint:
{
"parentFolder": null,
"displayName": "10% Off Orders Over $100 ",
"id": "promo20014",
"type": 9,
"enabled": true,
"cardIINRanges": [
"456789",
"9878",
"987634-987648"
]
}