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:
string
Required:true
The 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:
array
audiencesAdditional Properties Allowed:List of audiences to which the promotion is limited. An empty list implies no restrictions. - cardIINRanges
-
Type:
array
cardIINRangesAdditional Properties Allowed:List of issuer identification numbers including wildcards and ranges for which the promotion should be applied. - description
-
Type:
string
The description of the promotion. - displayName
-
Type:
string
Required:true
The display name of the promotion. - enabled
-
Type:
boolean
Whether or not the promotion is currently enabled. - endDate
-
Type:
string
When this promotion ceases to be active - excludedPromotions
-
Type:
array
excludedPromotionsAdditional 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:
object
parentFolderAdditional 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:
array
priceListGroupsAdditional Properties Allowed:The price List Groups - priority
-
Type:
string
Required:true
The priority of this promotion over other promotions - shippingMethods
-
Type:
array
shippingMethodsAdditional Properties Allowed:Shipping Methods for which the promotion should be applied - sites
-
Type:
array
sitesAdditional 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:
string
When this promotion becomes active - templateName
-
Type:
string
Required:true
The name of the promotion template to use. - templatePath
-
Type:
string
Required:true
The path to the promotion template. - templateValues
-
Type:
object
templateValuesAdditional 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:
array
List of issuer identification numbers including wildcards and ranges for which the promotion should be applied.
-
Type:
string
Nested Schema : excludedPromotions
Type:
array
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.
Nested Schema : parentFolder
Type:
object
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.
- repositoryId
-
Type:
string
Existing promotion folder's repository ID
Nested Schema : priceListGroups
Nested Schema : shippingMethods
Nested Schema : sites
Nested Schema : templateValues
Type:
object
Specifies the template values that are used as part of the promotion to control its behavior
- condition_psc_value
-
Type:
object
condition_psc_valueAdditional Properties Allowed:The condition product set criteria value - discount_type_value
-
Type:
string
The discount type - discount_value
-
Type:
string
The discount value - discountStructure
-
Type:
object
discountStructureAdditional Properties Allowed:The discount structure - gwpItem
-
Type:
object
gwpItemAdditional Properties Allowed:The gift with promotion configuration details - no_of_items_to_buy
-
Type:
string
The number of items to buy - no_of_items_to_discount
-
Type:
string
The number of items to discount - offer_psc_value
-
Type:
object
offer_psc_valueAdditional Properties Allowed:The offer product set criteria values - optional_offer_psc_value
-
Type:
object
optional_offer_psc_valueAdditional Properties Allowed:The offer product set criteria values - PSC_value
-
Type:
object
PSC_valueAdditional Properties Allowed:The product set criteria values - sort_by
-
Type:
string
The sort by condition - sort_order
-
Type:
string
The sort order - spend_value
-
Type:
string
The spend value
Nested Schema : items
Type:
object
- repositoryId
-
Type:
string
Required:true
The ID of an audience associated with the promotion.
Nested Schema : items
Type:
object
- repositoryId
-
Type:
string
Required:true
The promotion's repository ID
Nested Schema : items
Type:
object
- repositoryId
-
Type:
string
Required:true
The ID of a site associated with the promotion.
Nested Schema : condition_psc_value
Type:
object
The condition product set criteria value
- excludedCategories
-
Type:
array
excludedCategoriesAdditional Properties Allowed:The excluded categories - excludedProducts
-
Type:
array
excludedProductsAdditional Properties Allowed:The excluded products - includedCategories
-
Type:
array
includedCategoriesAdditional Properties Allowed:The included categories - includedProducts
-
Type:
array
includedProductsAdditional Properties Allowed:The included products
Nested Schema : discountStructure
Type:
object
The discount structure
- discount_details
-
Type:
array
discount_detailsAdditional Properties Allowed:The discount details - discount_type_value
-
Type:
string
The discount type value
Nested Schema : gwpItem
Type:
object
The gift with promotion configuration details
- autoRemove
-
Type:
boolean
Whether to remove item from cart when cart no longer meets buy condition - giftId
-
Type:
string
The product id of the gift item - giftType
-
Type:
string
The gift item type
Nested Schema : offer_psc_value
Type:
object
The offer product set criteria values
- excludedCategories
-
Type:
array
excludedCategoriesAdditional Properties Allowed:The excluded categories - excludedProducts
-
Type:
array
excludedProductsAdditional Properties Allowed:The excluded products - includedCategories
-
Type:
array
includedCategoriesAdditional Properties Allowed:The included categories - includedProducts
-
Type:
array
includedProductsAdditional Properties Allowed:The included products
Nested Schema : optional_offer_psc_value
Type:
object
The offer product set criteria values
- excludedCategories
-
Type:
array
excludedCategoriesAdditional Properties Allowed:The excluded categories - excludedProducts
-
Type:
array
excludedProductsAdditional Properties Allowed:The excluded products - includedCategories
-
Type:
array
includedCategoriesAdditional Properties Allowed:The included categories - includedProducts
-
Type:
array
includedProductsAdditional Properties Allowed:The included products - sameAsCondition
-
Type:
boolean
Items to include and exclude for offer are the same as items in buy condition
Nested Schema : PSC_value
Type:
object
The product set criteria values
- excludedCategories
-
Type:
array
excludedCategoriesAdditional Properties Allowed:The excluded categories - excludedProducts
-
Type:
array
excludedProductsAdditional Properties Allowed:The excluded products - includedCategories
-
Type:
array
includedCategoriesAdditional Properties Allowed:The included categories - includedProducts
-
Type:
array
includedProductsAdditional 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:
string
The discount value - spend_value
-
Type:
string
The 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:
array
cardIINRangesAdditional Properties Allowed:List of issuer identification numbers including wildcards and ranges for which the promotion should be applied. - displayName
-
Type:
string
The display name of the promotion. - enabled
-
Type:
boolean
Whether or not the promotion is currently enabled. - endDate
-
Type:
string
When this promotion ceases to be active - id
-
Type:
string
The Promotion id. - lastModified
-
Type:
string
When promotion was last modified - parentFolder
-
Type:
object
parentFolderAdditional Properties Allowed:Map of promotion folder's repository ID key and value. - repositoryId
-
Type:
string
The Promotion id. - sites
-
Type:
array
sitesAdditional 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:
object
stackingRuleAdditional Properties Allowed:Represents a rule to determine a group of promotions that can be used together. - startDate
-
Type:
string
When this promotion becomes active - type
-
Type:
integer
Integer representation of the promotion type (shipping, item, order).
Nested Schema : cardIINRanges
Type:
array
List of issuer identification numbers including wildcards and ranges for which the promotion should be applied.
-
Type:
string
Nested Schema : parentFolder
Type:
object
Map of promotion folder's repository ID key and value.
- repositoryId
-
Type:
string
The promotion folder's repository ID that the promotion is assigned to.
Nested Schema : sites
Nested Schema : stackingRule
Type:
object
Represents a rule to determine a group of promotions that can be used together.
- displayName
-
Type:
string
The name of the rule. - id
-
Type:
string
The stacking rule id. - maxPromotions
-
Type:
string
The maximum number of promotions that can be applied to an order based on this rule. - repositoryId
-
Type:
string
The stacking rule id
Nested Schema : items
Type:
object
- repositoryId
-
Type:
string
The 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:
string
An optional non-localized message containing technical information for developers - errorCode
-
Type:
string
The numerical code identifying the error - errors
-
Type:
array
errorsAdditional Properties Allowed:An optional list of errors if multiple errors were encountered - message
-
Type:
string
The localized message describing the error - moreInfo
-
Type:
string
An optional non-localized message with more information - o:errorPath
-
Type:
string
An optional machine readable description of where the error occurred - status
-
Type:
string
The HTTP status code - type
-
Type:
string
The URI to the HTTP state code definition
Nested Schema : errors
Nested Schema : items
Type:
object
- devMessage
-
Type:
string
An optional non-localized message containing technical information for developers - errorCode
-
Type:
string
The numerical code identifying the error - message
-
Type:
string
The localized message describing the error - moreInfo
-
Type:
string
An optional non-localized message with more information - o:errorPath
-
Type:
string
An optional machine readable description of where the error occurred - status
-
Type:
string
The 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" ] }