<!-- source: docs/api/2_capi/promotions/index.md -->
<!-- url: https://docs-internal.braincloudservers.com/api/capi/promotions -->

# Promotions

**Promotions** is a new service that allows devs to create/edit/delete promotions programmatically via S2S and cloud-code.

*Important notes (when creating or updating a promotion):*

* Include only products that you want to CHANGE the price of in the "prices" section of the JSON
* Products whose prices are to remain UNCHANGED should not be included in "prices"
* Products to remove from availability should be encoded with a priceId of -2
### API Summary

### Promotions
* [SysGetPromotionList](/api/capi/promotions/sysgetpromotionlist) - Returns the list of configured promotions (without full details).
* [SysReadPromotion](/api/capi/promotions/sysreadpromotion) - Returns the full configuration data of the specified promotion.
* [SysCreatePromotion](/api/capi/promotions/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()).
* [SysUpdatePromotion](/api/capi/promotions/sysupdatePromotion) - Updates the specified promotion with the provided promotionJson. Any promotionId included in the promotionJson will be ignored.
* [SysDeletePromotion](/api/capi/promotions/sysdeletePromotion) - Deletes the specified promotion from the server.
* [SysEnablePromotion](/api/capi/promotions/sysenablePromotion) - Enable/Disable a promotion. A convenience API for easily toggling a promotion on/off.


---

<!-- source: docs/api/2_capi/promotions/syscreatepromotion.md -->
<!-- url: https://docs-internal.braincloudservers.com/api/capi/promotions/syscreatepromotion -->

# 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). Supports two promotion types: **SCHEDULED** (requires `startAt` and `endAt` epoch timestamps) and **AUTOMATED** (requires `duration` in hours, and supports `isRetriggerable`, `maxRetriggers`, and `maxPurchases`).

> **Tip:** The `items` field can contain both individual items and bundles — each entry's `defId` determines whether it refers to an item or a bundle definition id.

## Usage

**C#:**

```csharp
// Cloud Code only. To view example, switch to the Cloud Code tab
```

**C++:**

```cpp
// Cloud Code only. To view example, switch to the Cloud Code tab
```

**Obj-C:**

```objectivec
// Cloud Code only. To view example, switch to the Cloud Code tab
```

**Java:**

```java
// Cloud Code only. To view example, switch to the Cloud Code tab
```

**JavaScript:**

```javascript
// Cloud Code only. To view example, switch to the Cloud Code tab
```

**Dart:**

```dart
// Cloud Code only. To view example, switch to the Cloud Code tab
```

**Roblox:**

```lua
-- N/A
```

**GDScript:**

```gdscript
N/A
```

**Lua:**

```lua
-- Cloud Code only. To view example, switch to the Cloud Code tab
```

**Cloud Code:**

```cfscript
// Example 1: SCHEDULED type
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
        }
    ],
    "items": {
        "item100": {
            "defId": "item100",
            "buyPrice": {
                "coins": 50
            }
        },
        "bundle100": {
            "defId": "bundle100",
            "buyPrice": {
                "coins": 150
            }
        }
    },
    "notifications": [
        {
            "trigger" : "ACTIVATED",
            "notificationTemplateId" : 1
        }
    ],
    "customJson": {
      "key": "value"
    }
  };
var promotionsProxy = bridge.getPromotionsServiceProxy();

var postResult = promotionsProxy.sysCreatePromotion(promotionJson);
if (postResult.status == 200) {
    // Success!
}

// Example 2: AUTOMATED type
var promotionJson = {
    "type": "AUTOMATED",
    "name": "Automated Promotion Example",
    "message": {
        "en": "This is a promotion with promotional product prices, items pricing info and custom json."
    },
    "enabled": false,
    "segments": [
        30
    ],
    "prices": [
        {
            "itemId": "gems50",
            "priceId": 2
        },
        {
            "itemId": "rubies50",
            "priceId": 3
        }
    ],
    "items": {
        "item100": {
            "defId": "item100",
            "buyPrice": {
                "coins": 50
            }
        },
        "bundle100": {
            "defId": "bundle100",
            "buyPrice": {
                "coins": 150
            }
        }
    },
    "notifications": [],
    "duration": 72,
    "customJson": {
        "bonus": 2
    },
    "isRetriggerable": true,
    "maxRetriggers": 10,
    "maxPurchases": 50
  };
var promotionsProxy = bridge.getPromotionsServiceProxy();

var postResult = promotionsProxy.sysCreatePromotion(promotionJson);
if (postResult.status == 200) {
    // Success!
}
```

**Raw:**

```r
{
    "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"
      }
    }
  }
}
```

<details>
<summary>JSON Response</summary>

```json
{
    "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
}
```
</details>


---

<!-- source: docs/api/2_capi/promotions/sysdeletepromotion.md -->
<!-- url: https://docs-internal.braincloudservers.com/api/capi/promotions/sysdeletepromotion -->

# SysDeletePromotion

Deletes the specified promotion from the server.

| Service | Operation |
| ------- | --------- |
| promotions | SYS_DELETE_PROMOTION |

> **Info:** Note: SysDeletePromotion will also delete archived promotions, not just active ones. Use this operation carefully if you intend to preserve archived promotion history.

## 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.

## Usage

**C#:**

```csharp
// Cloud Code only. To view example, switch to the Cloud Code tab
```

**C++:**

```cpp
// Cloud Code only. To view example, switch to the Cloud Code tab
```

**Obj-C:**

```objectivec
// Cloud Code only. To view example, switch to the Cloud Code tab
```

**Java:**

```java
// Cloud Code only. To view example, switch to the Cloud Code tab
```

**JavaScript:**

```javascript
// Cloud Code only. To view example, switch to the Cloud Code tab
```

**Dart:**

```dart
// Cloud Code only. To view example, switch to the Cloud Code tab
```

**Roblox:**

```lua
-- N/A
```

**GDScript:**

```gdscript
N/A
```

**Lua:**

```lua
-- Cloud Code only. To view example, switch to the Cloud Code tab
```

**Cloud Code:**

```cfscript
var promotionId = 1;
var version = 2;
var promotionsProxy = bridge.getPromotionsServiceProxy();

var postResult = promotionsProxy.sysDeletePromotion(promotionId, version);
if (postResult.status == 200) {
    // Success!
}
```

**Raw:**

```r
{
    "service": "promotions",
    "operation": "SYS_DELETE_PROMOTION",
    "data": {
    "promotionId": 1,
    "version": 1
  }
}
```

<details>
<summary>JSON Response</summary>

```json
{
    "data": null,
    "status": 200
}
```
</details>


---

<!-- source: docs/api/2_capi/promotions/sysenablepromotion.md -->
<!-- url: https://docs-internal.braincloudservers.com/api/capi/promotions/sysenablepromotion -->

# SysEnablePromotion

Enable/Disable a promotion. A convenience API for easily toggling a promotion on/off.

| Service | Operation |
| ------- | --------- |
| promotions | SYS_ENABLE_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.
enabled | Flag true to enable promotion, false to disable promotion.

## Usage

**C#:**

```csharp
// Cloud Code only. To view example, switch to the Cloud Code tab
```

**C++:**

```cpp
// Cloud Code only. To view example, switch to the Cloud Code tab
```

**Obj-C:**

```objectivec
// Cloud Code only. To view example, switch to the Cloud Code tab
```

**Java:**

```java
// Cloud Code only. To view example, switch to the Cloud Code tab
```

**JavaScript:**

```javascript
// Cloud Code only. To view example, switch to the Cloud Code tab
```

**Dart:**

```dart
// Cloud Code only. To view example, switch to the Cloud Code tab
```

**Roblox:**

```lua
-- N/A
```

**GDScript:**

```gdscript
N/A
```

**Lua:**

```lua
-- Cloud Code only. To view example, switch to the Cloud Code tab
```

**Cloud Code:**

```cfscript
var promotionId = 1;
var version = 1;
var enabled = true;
var promotionsProxy = bridge.getPromotionsServiceProxy();

var postResult = promotionsProxy.sysEnablePromotion(promotionId, version, enabled);
if (postResult.status == 200) {
    // Success!
}
```

**Raw:**

```r
{
    "service": "promotions",
    "operation": "SYS_ENABLE_PROMOTION",
    "data": {
    "promotionId": 1,
    "version": 1,
    "enabled": true
  }
}
```

<details>
<summary>JSON Response</summary>

```json
{
    "data": {
        "promotion": {
            "promotionId": 1,
            "type": "SCHEDULED",
            "name": "Independence Day Sale",
            "message": {
                "en": "Happy 4th of July!"
            },
            "enabled": true,
            "segments": [],
            "prices": [
                {
                    "itemId": "coinbundle10",
                    "priceId": 0
                }
            ],
            "notifications": [
                {
                    "trigger": "ACTIVATED",
                    "notificationTemplateId": 1
                }
            ],
            "startAt": 1593781259911,
            "endAt": 1594126859911,
            "createdAt": 1592543866698,
            "updatedAt": 1592590019283,
            "version": 2
        }
    },
    "status": 200
}
```
</details>


---

<!-- source: docs/api/2_capi/promotions/sysgetpromotionlist.md -->
<!-- url: https://docs-internal.braincloudservers.com/api/capi/promotions/sysgetpromotionlist -->

# SysGetPromotionList

Returns the list of configured promotions (without full details).

| Service | Operation |
| ------- | --------- |
| promotions | SYS_GET_PROMOTION_LIST |

## Method Parameters
Parameter | Description
--------- | -----------
type | SCHEDULED or AUTOMATED to filter specific type, or empty string to return all promotions.

## Usage

**C#:**

```csharp
// Cloud Code only. To view example, switch to the Cloud Code tab
```

**C++:**

```cpp
// Cloud Code only. To view example, switch to the Cloud Code tab
```

**Obj-C:**

```objectivec
// Cloud Code only. To view example, switch to the Cloud Code tab
```

**Java:**

```java
// Cloud Code only. To view example, switch to the Cloud Code tab
```

**JavaScript:**

```javascript
// Cloud Code only. To view example, switch to the Cloud Code tab
```

**Dart:**

```dart
// Cloud Code only. To view example, switch to the Cloud Code tab
```

**Roblox:**

```lua
-- N/A
```

**GDScript:**

```gdscript
N/A
```

**Lua:**

```lua
-- Cloud Code only. To view example, switch to the Cloud Code tab
```

**Cloud Code:**

```cfscript
var type = "SCHEDULED"
var promotionsProxy = bridge.getPromotionsServiceProxy();

var postResult = promotionsProxy.sysGetPromotionList(type);
if (postResult.status == 200) {
    // Success!
}
```

**Raw:**

```r
{
    "service": "promotions",
    "operation": "SYS_GET_PROMOTION_LIST",
    "data": {
    "type": "SCHEDULED"
  }
}
```

<details>
<summary>JSON Response</summary>

```json
{
    "data": {
        "promotions": [
            {
                "promotionId": 1,
                "type": "SCHEDULED",
                "name": "Independence Day Sale",
                "enabled": false,
                "segments": [],
                "startAt": 1593781259911,
                "endAt": 1594126859911,
                "createdAt": 1592543345470,
                "updatedAt": 1592543345470,
                "version": 1
            },
            {
                "promotionId": 2,
                "type": "SCHEDULED",
                "name": "Good Friday Day Sale",
                "enabled": false,
                "segments": [],
                "startAt": 1593781259911,
                "endAt": 1594126859911,
                "createdAt": 1592572610332,
                "updatedAt": 1592572610332,
                "version": 1
            }
        ]
    },
    "status": 200
}
```
</details>


---

<!-- source: docs/api/2_capi/promotions/sysreadpromotion.md -->
<!-- url: https://docs-internal.braincloudservers.com/api/capi/promotions/sysreadpromotion -->

# SysReadPromotion

Returns the full configuration data of the specified promotion.

| Service | Operation |
| ------- | --------- |
| promotions | SYS_READ_PROMOTION |

## Method Parameters
Parameter | Description
--------- | -----------
promotionId | ID uniquely identifying the promotion to read.

## Usage

**C#:**

```csharp
// Cloud Code only. To view example, switch to the Cloud Code tab
```

**C++:**

```cpp
// Cloud Code only. To view example, switch to the Cloud Code tab
```

**Obj-C:**

```objectivec
// Cloud Code only. To view example, switch to the Cloud Code tab
```

**Java:**

```java
// Cloud Code only. To view example, switch to the Cloud Code tab
```

**JavaScript:**

```javascript
// Cloud Code only. To view example, switch to the Cloud Code tab
```

**Dart:**

```dart
// Cloud Code only. To view example, switch to the Cloud Code tab
```

**Roblox:**

```lua
-- N/A
```

**GDScript:**

```gdscript
N/A
```

**Lua:**

```lua
-- Cloud Code only. To view example, switch to the Cloud Code tab
```

**Cloud Code:**

```cfscript
var promotionId = 1
var promotionsProxy = bridge.getPromotionsServiceProxy();

var postResult = promotionsProxy.sysReadPromotion(promotionId);
if (postResult.status == 200) {
    // Success!
}
```

**Raw:**

```r
{
    "service": "promotions",
    "operation": "SYS_READ_PROMOTION",
    "data": {
    "promotionId": 1
  }
}
```

<details>
<summary>JSON Response</summary>

```json
{
    "data": {
        "promotion": {
            "promotionId": 1,
            "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": 1592543345470,
            "updatedAt": 1592543345470,
            "version": 1
        }
    },
    "status": 200
}
```
</details>


---

<!-- source: docs/api/2_capi/promotions/sysupdatepromotion.md -->
<!-- url: https://docs-internal.braincloudservers.com/api/capi/promotions/sysupdatepromotion -->

# 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

**C#:**

```csharp
// Cloud Code only. To view example, switch to the Cloud Code tab
```

**C++:**

```cpp
// Cloud Code only. To view example, switch to the Cloud Code tab
```

**Obj-C:**

```objectivec
// Cloud Code only. To view example, switch to the Cloud Code tab
```

**Java:**

```java
// Cloud Code only. To view example, switch to the Cloud Code tab
```

**JavaScript:**

```javascript
// Cloud Code only. To view example, switch to the Cloud Code tab
```

**Dart:**

```dart
// Cloud Code only. To view example, switch to the Cloud Code tab
```

**Roblox:**

```lua
-- N/A
```

**GDScript:**

```gdscript
N/A
```

**Lua:**

```lua
-- Cloud Code only. To view example, switch to the Cloud Code tab
```

**Cloud Code:**

```cfscript
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!
}
```

**Raw:**

```r
{
    "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"
        }
    }
  }
}
```

<details>
<summary>JSON Response</summary>

```json
{
    "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
}
```
</details>


---

<!-- source: docs/api/4_s2s/promotions/index.md -->
<!-- url: https://docs-internal.braincloudservers.com/api/s2s/promotions -->

# Promotions

**Promotions** is a new service that allows devs to create/edit/delete promotions programmatically via S2S and cloud-code.

*Important notes (when creating or updating a promotion):*

* Include only products that you want to CHANGE the price of in the "prices" section of the JSON
* Products whose prices are to remain UNCHANGED should not be included in "prices"
* Products to remove from availability should be encoded with a priceId of -2
### API Summary

### Promotions
* [SysGetPromotionList](/api/s2s/promotions/sysgetpromotionlist) - Returns the list of configured promotions (without full details).
* [SysReadPromotion](/api/s2s/promotions/sysreadpromotion) - Returns the full configuration data of the specified promotion.
* [SysCreatePromotion](/api/s2s/promotions/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()).
* [SysUpdatePromotion](/api/s2s/promotions/sysupdatePromotion) - Updates the specified promotion with the provided promotionJson. Any promotionId included in the promotionJson will be ignored.
* [SysDeletePromotion](/api/s2s/promotions/sysdeletePromotion) - Deletes the specified promotion from the server.
* [SysEnablePromotion](/api/s2s/promotions/sysenablePromotion) - Enable/Disable a promotion. A convenience API for easily toggling a promotion on/off.


---

<!-- source: docs/api/4_s2s/promotions/syscreatepromotion.md -->
<!-- url: https://docs-internal.braincloudservers.com/api/s2s/promotions/syscreatepromotion -->

# 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

**C#:**

```csharp
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**C++:**

```cpp
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Obj-C:**

```objectivec
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Java:**

```java
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**JavaScript:**

```javascript
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Dart:**

```dart
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Roblox:**

```lua
-- N/A
```

**GDScript:**

```gdscript
N/A
```

**Lua:**

```lua
-- S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Cloud Code:**

```cfscript
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!
}
```

**Raw:**

```r
{
    "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"
      }
    }
  }
}
```

<details>
<summary>JSON Response</summary>

```json
{
    "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
}
```

</details>


---

<!-- source: docs/api/4_s2s/promotions/sysdeletepromotion.md -->
<!-- url: https://docs-internal.braincloudservers.com/api/s2s/promotions/sysdeletepromotion -->

# SysDeletePromotion

Deletes the specified promotion from the server.

| Service | Operation |
| ------- | --------- |
| promotions | SYS_DELETE_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.                                                                                                        |

## Usage

**C#:**

```csharp
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**C++:**

```cpp
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Obj-C:**

```objectivec
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Java:**

```java
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**JavaScript:**

```javascript
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Dart:**

```dart
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Roblox:**

```lua
-- N/A
```

**GDScript:**

```gdscript
N/A
```

**Lua:**

```lua
-- S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Cloud Code:**

```cfscript
var promotionId = 1;
var version = 2;
var promotionsProxy = bridge.getPromotionsServiceProxy();

var postResult = promotionsProxy.sysDeletePromotion(promotionId, version);
if (postResult.status == 200) {
    // Success!
}
```

**Raw:**

```r
{
    "service": "promotions",
    "operation": "SYS_DELETE_PROMOTION",
    "data": {
    "promotionId": 1,
    "version": 1
  }
}
```

<details>
<summary>JSON Response</summary>

```json
{
    "data": null,
    "status": 200
}
```

</details>


---

<!-- source: docs/api/4_s2s/promotions/sysenablepromotion.md -->
<!-- url: https://docs-internal.braincloudservers.com/api/s2s/promotions/sysenablepromotion -->

# SysEnablePromotion

Enable/Disable a promotion. A convenience API for easily toggling a promotion on/off.

| Service | Operation |
| ------- | --------- |
| promotions | SYS_ENABLE_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.                                                                                                        |
| enabled     | Flag true to enable promotion, false to disable promotion.                                                                                                                            |

## Usage

**C#:**

```csharp
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**C++:**

```cpp
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Obj-C:**

```objectivec
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Java:**

```java
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**JavaScript:**

```javascript
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Dart:**

```dart
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Roblox:**

```lua
-- N/A
```

**GDScript:**

```gdscript
N/A
```

**Lua:**

```lua
-- S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Cloud Code:**

```cfscript
var promotionId = 1;
var version = 1;
var enabled = true;
var promotionsProxy = bridge.getPromotionsServiceProxy();

var postResult = promotionsProxy.sysEnablePromotion(promotionId, version, enabled);
if (postResult.status == 200) {
    // Success!
}
```

**Raw:**

```r
{
    "service": "promotions",
    "operation": "SYS_ENABLE_PROMOTION",
    "data": {
    "promotionId": 1,
    "version": 1,
    "enabled": true
  }
}
```

<details>
<summary>JSON Response</summary>

```json
{
    "data": {
        "promotion": {
            "promotionId": 1,
            "type": "SCHEDULED",
            "name": "Independence Day Sale",
            "message": {
                "en": "Happy 4th of July!"
            },
            "enabled": true,
            "segments": [],
            "prices": [
                {
                    "itemId": "coinbundle10",
                    "priceId": 0
                }
            ],
            "notifications": [
                {
                    "trigger": "ACTIVATED",
                    "notificationTemplateId": 1
                }
            ],
            "startAt": 1593781259911,
            "endAt": 1594126859911,
            "createdAt": 1592543866698,
            "updatedAt": 1592590019283,
            "version": 2
        }
    },
    "status": 200
}
```

</details>


---

<!-- source: docs/api/4_s2s/promotions/sysgetpromotionlist.md -->
<!-- url: https://docs-internal.braincloudservers.com/api/s2s/promotions/sysgetpromotionlist -->

# SysGetPromotionList

Returns the list of configured promotions (without full details).

| Service | Operation |
| ------- | --------- |
| promotions | SYS_GET_PROMOTION_LIST |

## Method Parameters

| Parameter | Description                                                                               |
| --------- | ----------------------------------------------------------------------------------------- |
| type      | SCHEDULED or AUTOMATED to filter specific type, or empty string to return all promotions. |

## Usage

**C#:**

```csharp
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**C++:**

```cpp
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Obj-C:**

```objectivec
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Java:**

```java
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**JavaScript:**

```javascript
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Dart:**

```dart
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Roblox:**

```lua
-- N/A
```

**GDScript:**

```gdscript
N/A
```

**Lua:**

```lua
-- S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Cloud Code:**

```cfscript
var type = "SCHEDULED"
var promotionsProxy = bridge.getPromotionsServiceProxy();

var postResult = promotionsProxy.sysGetPromotionList(type);
if (postResult.status == 200) {
    // Success!
}
```

**Raw:**

```r
{
    "service": "promotions",
    "operation": "SYS_GET_PROMOTION_LIST",
    "data": {
    "type": "SCHEDULED"
  }
}
```

<details>
<summary>JSON Response</summary>

```json
{
    "data": {
        "promotions": [
            {
                "promotionId": 1,
                "type": "SCHEDULED",
                "name": "Independence Day Sale",
                "enabled": false,
                "segments": [],
                "startAt": 1593781259911,
                "endAt": 1594126859911,
                "createdAt": 1592543345470,
                "updatedAt": 1592543345470,
                "version": 1
            },
            {
                "promotionId": 2,
                "type": "SCHEDULED",
                "name": "Good Friday Day Sale",
                "enabled": false,
                "segments": [],
                "startAt": 1593781259911,
                "endAt": 1594126859911,
                "createdAt": 1592572610332,
                "updatedAt": 1592572610332,
                "version": 1
            }
        ]
    },
    "status": 200
}
```

</details>


---

<!-- source: docs/api/4_s2s/promotions/sysreadpromotion.md -->
<!-- url: https://docs-internal.braincloudservers.com/api/s2s/promotions/sysreadpromotion -->

# SysReadPromotion

Returns the full configuration data of the specified promotion.

| Service | Operation |
| ------- | --------- |
| promotions | SYS_READ_PROMOTION |

## Method Parameters

| Parameter   | Description                                    |
| ----------- | ---------------------------------------------- |
| promotionId | ID uniquely identifying the promotion to read. |

## Usage

**C#:**

```csharp
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**C++:**

```cpp
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Obj-C:**

```objectivec
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Java:**

```java
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**JavaScript:**

```javascript
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Dart:**

```dart
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Roblox:**

```lua
-- N/A
```

**GDScript:**

```gdscript
N/A
```

**Lua:**

```lua
-- S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Cloud Code:**

```cfscript
var promotionId = 1
var promotionsProxy = bridge.getPromotionsServiceProxy();

var postResult = promotionsProxy.sysReadPromotion(promotionId);
if (postResult.status == 200) {
    // Success!
}
```

**Raw:**

```r
{
    "service": "promotions",
    "operation": "SYS_READ_PROMOTION",
    "data": {
    "promotionId": 1
  }
}
```

<details>
<summary>JSON Response</summary>

```json
{
    "data": {
        "promotion": {
            "promotionId": 1,
            "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": 1592543345470,
            "updatedAt": 1592543345470,
            "version": 1
        }
    },
    "status": 200
}
```

</details>


---

<!-- source: docs/api/4_s2s/promotions/sysupdatepromotion.md -->
<!-- url: https://docs-internal.braincloudservers.com/api/s2s/promotions/sysupdatepromotion -->

# 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

**C#:**

```csharp
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**C++:**

```cpp
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Obj-C:**

```objectivec
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Java:**

```java
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**JavaScript:**

```javascript
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Dart:**

```dart
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Roblox:**

```lua
-- N/A
```

**GDScript:**

```gdscript
N/A
```

**Lua:**

```lua
-- S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Cloud Code:**

```cfscript
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!
}
```

**Raw:**

```r
{
    "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"
        }
    }
  }
}
```

<details>
<summary>JSON Response</summary>

```json
{
    "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
}
```

</details>
