Creating Coupons for Incentives
You can use this API to create coupons for incentives.
When you generate coupons using the API, if any duplicate coupon code is generated, the job fails and you need to execute the job again.
API |
Signature |
---|---|
createCouponsForIncentives |
webService static Apttus_CPQApi.CPQ.CreateCouponsForIncentiveResponseDO createCouponsForIncentives(Apttus_CPQApi.CPQ.CreateCouponsForIncentiveRequestDO request) |
Request Parameter |
||
---|---|---|
Name |
Type |
Description |
request | Apttus_CPQApi.CPQ.CreateCouponsForIncentiveRequestDO |
The request data object. |
Request Data Object - Apttus_CPQApi.CPQ.CreateCouponsForIncentiveRequestDO |
||
---|---|---|
Name |
Type |
Description |
IncentiveIds | List |
The IDs of the incentives for which you want to generate coupons. |
NumCoupons | List |
The number of coupons you want to generate. For example, if you enter 10000, CPQ will generate 10000 coupons for the specified incentive. |
Reponse Parameter Data Object - Apttus_CPQApi.CPQ.CreateCouponsForIncentiveResponseDO |
||
---|---|---|
Name |
Type |
Description |
Coupons | List |
The list of generated coupon codes. |
IsAsync | Boolean |
Indicates whether coupons were created in aysnc mode or not.
|
JobId | Id |
The ID of the job created to generate coupons. |
Code Sample
The sample code below demonstrates the coupons created in sync mode and async mode.
//Sync Test
Apttus_CPQApi.CPQ.CreateCouponsForIncentiveRequestDO request = new Apttus_CPQApi.CPQ.CreateCouponsForIncentiveRequestDO();
request.IncentiveIds.add(incentiveSO.Id);
// add corresponding number of coupons parameter
request.NumCoupons.add(5);
Apttus_CPQApi.CPQ.CreateCouponsForIncentiveResponseDO result = Apttus_CPQApi.CPQWebService.createCouponsForIncentives(request);
//Async Test
Apttus_CPQApi.CPQ.CreateCouponsForIncentiveRequestDO request2 = new Apttus_CPQApi.CPQ.CreateCouponsForIncentiveRequestDO();
request2.IncentiveIds.add(incentiveSO.Id);
request2.IncentiveIds.add(incentiveSO2.Id);
// add corresponding number of coupons parameter
request2.NumCoupons.add(5);
request2.NumCoupons.add(5);
Apttus_CPQApi.CPQ.CreateCouponsForIncentiveResponseDO result2 = Apttus_CPQApi.CPQWebService.createCouponsForIncentives(request2);