SysUpdatePromotion
Updates the specified promotion with the provided promotionJson. Any promotionId included in the promotionJson will be ignored.
Service | Operation |
---|---|
promotions | SYS_UPDATE_PROMOTION |
Method Parameters
Parameter | Description |
---|---|
promotionId | ID uniquely identifying the promotion to update. Note: If promotionId is included in the promotionJson, it is ignored. The promotionId provided as a direct parameter takes priority. |
version | Version of the promotion to update. Can bypass version check by passing in -1. |
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 promotionId = 1;
var version = 1;
var promotionJson ={
"name": "Independence Day Sale",
"type": "SCHEDULED",
"startAt": 1593781140000,
"endAt": 1594126859999,
"message": {
"en": "Happy 4th of July!",
"fr": "Joyeux 4 juillet!"
},
"enabled": true,
"segments": [ 1 ],
"prices": [
{
"itemId": "coinbundle10",
"priceId": 1
}
],
"notifications": [
{
"trigger" : "ACTIVATED",
"notificationTemplateId" : 1
}
],
"customJson": {
"key": "value"
}
}
var promotionsProxy = bridge.getPromotionsServiceProxy();
var postResult = promotionsProxy.sysUpdatePromotion(promotionId, version, promotionJson);
if (postResult.status == 200) {
// Success!
}
{
"service": "promotions",
"operation": "SYS_UPDATE_PROMOTION",
"data": {
"promotionId": 1,
"version": 2,
"promotionJson": {
"name": "Independence Day Sale",
"type": "SCHEDULED",
"startAt": 1593781140000,
"endAt": 1594126859999,
"message": {
"en": "Happy 4th of July!",
"fr": "Joyeux 4 juillet!"
},
"enabled": true,
"segments": [ 1 ],
"prices": [
{
"itemId": "coinbundle10",
"priceId": 1
}
],
"notifications": [
{
"trigger" : "ACTIVATED",
"notificationTemplateId" : 2
}
],
"customJson": {
"key": "value"
}
}
}
}
JSON Response
{
"data": {
"promotion": {
"promotionId": 1,
"type": "SCHEDULED",
"name": "Independence Day Sale",
"message": {
"en": "Happy 4th of July!",
"fr": "Joyeux 4 juillet!"
},
"enabled": true,
"segments": [
1
],
"prices": [
{
"itemId": "coinbundle10",
"priceId": 1
}
],
"notifications": [
{
"trigger": "ACTIVATED",
"notificationTemplateId": 1
}
],
"customJson": {
"key": "value"
},
"startAt": 1593781140000,
"endAt": 1594126859999,
"createdAt": 1592543345470,
"updatedAt": 1592589083592,
"version": 2
}
},
"status": 200
}