You must use the Oracle Commerce Cloud Admin API to assign multiple promotions to a coupon or coupon batch. You cannot perform these tasks on the Marketing tab in the administration interface.
You can assign promotions to a new coupon or batch when you create it or you can update an existing coupon or batch so that it applies to multiple promotions:
To assign multiple promotions to a coupon when you create it, issue a POST request to
/ccadmin/v1/claimables
.To assign multiple promotions to a coupon batch when you create it, issue a POST request to
/ccadmin/v1/couponBatches
.To associate promotions with an existing coupon, issue a PUT request to
/ccadmin/v1/claimables/{id}
.To associate promotions with an existing coupon batch, issue a PUT request to
/ccadmin/v1/couponBatches/{id}
.
Keep the following points in mind when assigning promotions to coupons and coupon batches:
The promotions you want to assign to a coupon or coupon batch must already exist; simply specifying a promotion ID when you create or update a coupon or coupon batch does not automatically create the promotion.
To assign additional promotions to an existing coupon or coupon batch that already has promotions assigned to it, include both the new promotions and the existing promotions in the PUT request. To replace the existing promotions with new promotions, include only the new promotions in the PUT request.
Each coupon or coupon batch has a
startDate
property that specifies the date and time the coupon or batch is available for use, for example, to be associated with shopper profiles. You can specify a start date when you create a coupon or coupon batch. By default, if a newly-created coupon or batch is associated with only one promotion, itsstartDate
value is the same as thestartDate
value of the promotion. If a coupon or batch is associated with multiple promotions, the value of itsstartDate
property isnull
.You can change the value of the
startDate
for a coupon or coupon batch with a PUT request to/ccadmin/v1/claimables/{id}
or/ccadmin/v1/couponBatches/{id}
.Note: If you update a promotion, either through the Marketing tab in the administration interface or with the Admin API, the value of the
startDate
property of any coupons or batches associated with the updated promotion is automatically reset to thestartDate
value of the updated promotion. If you update a promotion whose child coupons have a differentstartDate
value than the promotion itself, remember to reset thestartDate
value of each child coupon or batch to avoid unexpected behavior.
The following example creates a new coupon that applies to two promotions:
POST /ccadmin/v1/claimables HTTP/1.1
Content-Type: application/json
Authorization: Bearer <access_token>
{
"promotions":[{"repositoryId":"promo10001"},{"repositoryId":"promo10003"}],
"id": "MYSALE",
"maxUses": "3"
}
If the coupon is created successfully, the response body returned includes the ID for the new coupon:
{ "repositoryId": "MYSALE" }
The following example shows a sample request that adds four promotions to an existing coupon batch.
PUT /ccadmin/v1/couponBatches/{SAVE2a462ON50} HTTP/1.1
Content-Type: application/json
Authorization: Bearer <access_token>
{
"promotions": [
{"repositoryId": "promo10001"},
{"repositoryId": "promo10002"},
{"repositoryId": "promo10003"},
{"repositoryId": "promo10006"}]
}
The following shows the response body returned:
{ "id": "SAVE2a462ON50", "numberOfCoupons": 100, "maxUses": 8, "numberClaimed": 0, "prefix": "Summer Sale", "promotions": [ {"repositoryId": "promo10001"}, {"repositoryId": "promo10002"}, {"repositoryId": "promo10003"}, {"repositoryId": "promo10006"} ], "uses": 0, "repositoryId": "SAVE2a462ON50" }