SysCreatePromotion
Creates a new promotion. The full promotion JSON (minus the promotionId) should be provided. The full promotion JSON, including the created promotionId, will be returned as a result (similar to SysReadPromotion()).
Service | Operation |
---|---|
promotions | SYS_CREATE_PROMOTION |
Method Parameters
Parameter | Description |
---|---|
promotionJson | The full promotion JSON (minus the promotionId). |
Usage
http://localhost:3000
- C#
- C++
- Objective-C
- Java
- JavaScript
- Dart
- Cloud Code
- Raw
// Cloud Code only. To view example, switch to the Cloud Code tab
// Cloud Code only. To view example, switch to the Cloud Code tab
// Cloud Code only. To view example, switch to the Cloud Code tab
// Cloud Code only. To view example, switch to the Cloud Code tab
// Cloud Code only. To view example, switch to the Cloud Code tab
// Cloud Code only. To view example, switch to the Cloud Code tab
var promotionJson = {
"name": "Independence Day Sale",
"type": "SCHEDULED",
"startAt": 1593781259911,
"endAt": 1594126859911,
"message": {
"en": "Happy 4th of July!"
},
"enabled": false,
"segments": [],
"prices": [
{
"itemId": "coinbundle10",
"priceId": 0
}
],
"notifications": [
{
"trigger" : "ACTIVATED",
"notificationTemplateId" : 1
}
],
"customJson": {
"key": "value"
}
};
var promotionsProxy = bridge.getPromotionsServiceProxy();
var postResult = promotionsProxy.sysCreatePromotion(promotionJson);
if (postResult.status == 200) {
// Success!
}
{
"service": "promotions",
"operation": "SYS_CREATE_PROMOTION",
"data": {
"promotionJson": {
"name": "Independence Day Sale",
"type": "SCHEDULED",
"startAt": 1593781259911,
"endAt": 1594126859911,
"message": {
"en": "Happy 4th of July!"
},
"enabled": false,
"segments": [],
"prices": [
{
"itemId": "coinbundle10",
"priceId": 0
}
],
"notifications": [
{
"trigger" : "ACTIVATED",
"notificationTemplateId" : 1
}
],
"customJson": {
"key": "value"
}
}
}
}
JSON Response
{
"data": {
"gameId": "23783",
"promotionId": 3,
"type": "SCHEDULED",
"name": "Independence Day Sale",
"message": {
"en": "Happy 4th of July!"
},
"enabled": false,
"segments": [],
"prices": [
{
"itemId": "coinbundle10",
"priceId": 0
}
],
"notifications": [
{
"trigger": "ACTIVATED",
"notificationTemplateId": 1
}
],
"customJson": {
"key": "value"
},
"startAt": 1593781259911,
"endAt": 1594126859911,
"createdAt": 1592544049481,
"updatedAt": 1592544049481,
"version": 1
},
"status": 200
}