<!-- source: docs/api/2_capi/gamification/awardachievements.md -->
<!-- url: https://docs.braincloudservers.com/api/capi/gamification/awardachievements -->

# AwardAchievements

Method will award the achievements specified.

| Service | Operation |
| ------- | --------- |
| gamification | AWARD_ACHIEVEMENTS |

## Method Parameters

| Parameter      | Description                        |
| -------------- | ---------------------------------- |
| achievementIds | A list of achievement ids to award |

## Usage

**C#:**

```csharp
string[] achievements = { "EGG_ACH09", "EGG_ACH10" };
SuccessCallback successCallback = (response, cbObject) =>
{
    Debug.Log(string.Format("Success | {0}", response));
};
FailureCallback failureCallback = (status, code, error, cbObject) =>
{
    Debug.Log(string.Format("Failed | {0}  {1}  {2}", status, code, error));
};

_bc.GamificationService.AwardAchievements(achievements, successCallback, failureCallback);
```

**C++:**

```cpp
std::vector<std::string> achievements;
achievements.push_back("EGG_ACH09");
achievements.push_back("EGG_ACH10");
_bc->getGamificationService()->awardAchievements(achievements, this);
```

**Obj-C:**

```objectivec
NSArray *achievements = @[ @"EGG_ACH09", @"EGG_ACH10" ];
BCCompletionBlock successBlock;      // define callback
BCErrorCompletionBlock failureBlock; // define callback

[[_bc gamificationService] awardAchievements:achievements
            completionBlock:successBlock
       errorCompletionBlock:failureBlock
                   cbObject:nil];
```

**Java:**

```java
String[] achievements = { "EGG_ACH09", "EGG_ACH10" };
this; // implements IServerCallback

_bc.getGamificationService().awardAchievements(achievements, this);

public void serverCallback(ServiceName serviceName, ServiceOperation serviceOperation, JSONObject jsonData)
{
    System.out.print(String.format("Success | %s", jsonData.toString()));
}
public void serverError(ServiceName serviceName, ServiceOperation serviceOperation, int statusCode, int reasonCode, String jsonError)
{
    System.out.print(String.format("Failed | %d %d %s", statusCode,  reasonCode, jsonError.toString()));
}
```

**JavaScript:**

```javascript
var achievements = [ "EGG_ACH09", "EGG_ACH10" ];

_bc.gamification.awardAchievements(achievements, result =>
{
    var status = result.status;
    console.log(status + " : " + JSON.stringify(result, null, 2));
});
```

**Dart:**

```dart
var  achievements = [ "EGG_ACH09", "EGG_ACH10" ];

ServerResponse result = await _bc.gamificationService.awardAchievements(achievements:achievements);

if (result.statusCode == 200) {
    print("Success");
} else {
    print("Failed ${result.error['status_message'] ?? result.error}");
}
```

**Roblox:**

```lua
local achievements = { "EGG_ACH09", "EGG_ACH10" }

local callback = function(success, response)
    if success then
        print("Success")
    else
        print("Failed | " .. tostring(response.status_message))
    end
end

_bc.gamification:awardAchievements(achievements, callback)
```

**GDScript:**

```gdscript
var achievements = [ "EGG_ACH09", "EGG_ACH10" ]

var result = await _bc.gamification_service.award_achievements(achievements)

if result.status == 200:
	print("Success")
else:
	print("Failed: %s" % result.status_message)
```

**Lua:**

```lua
local achievements = { "EGG_ACH09", "EGG_ACH10" }

local callback = function(success, response)
    if success then
        print("Success")
    else
        print("Failed | " .. tostring(response.status_message))
    end
end

_bc.gamification:awardAchievements(achievements, callback)
```

**Cloud Code:**

```cfscript
var achievements = [ "EGG_ACH09", "EGG_ACH10" ];
var gamificationProxy = bridge.getGamificationServiceProxy();

//includeMetaData Whether to return meta data as well, Boolean
var includeMetaData = false;
var postResult = gamificationProxy.awardAchievements(achievements, includeMetaData);
if (postResult.status == 200) {
    // Success!
}
```

**Raw:**

```r
{
    "service": "gamification",
    "operation": "AWARD_ACHIEVEMENTS",
    "data": {
        "achievements": [
            "EGG_ACH09",
            "EGG_ACH10"
        ]
    }
}
```

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

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

</details>


---

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

# Gamification

brainCloud's Gamification features provide server-side support common metagame elements, including:

-   Experience Points (XP) and Levels
-   Achievements
-   Milestones
-   Quests
-   Stats Events

These features build upon the Statistics APIs and a concept of Player Rewards.

### Player Rewards

brainCloud provides an ability to reward players for completing meta-goals: leveling up, completing a milestone and/or completing quests. Rewards can consist of:

-   Achievements
-   Experience Points
-   Currencies
-   User Statistics
-   Global Statistics

### XP Levels

brainCloud can manage experience points (XP) and levels, and reward the player for levelling up.

A player's XP starts at 0, and is incremented using methods of the Player Statistics service. A list of player XP levels can be read from the client using [ReadXPLevelsMetaData](/api/capi/gamification/readxplevelsmetadata).

### Achievements

Achievements can be triggered manually, or as the result of player rewards.
Achievements can be awarded directly using the [AwardAchievements](/api/capi/gamification/awardachievements) API. There are also API calls for retrieving the full list of achievements, and the list of achievements that have already been awarded for the player.

### Milestones

Milestones are used to define conditions under which rewards are to be delivered. Milestones must first be unlocked before they can be completed and then awarded.

![Milestones](@site/docs/img/api-img/milestone.png)

### Quests

Quests are essentially compound Milestones. The completion status of the Quest is derived from the completion status of the Tasks (i.e. embedded Milestones) that it is composed of.

![Quests](@site/docs/img/api-img/quest.png)

### API Summary

### General

-   [ReadAllGamification](/api/capi/gamification/readallgamification)
-   [ReadXpLevelsMetaData](/api/capi/gamification/readxplevelsmetadata)
-   [UpdateRewards (CC Only)](/api/capi/gamification/updaterewards)

### Achievements

-   [AwardAchievements](/api/capi/gamification/awardachievements)
-   [ReadAchievements](/api/capi/gamification/readachievements)
-   [ReadAchievedAchievements](/api/capi/gamification/readachievedachievements)

### Milestones

-   [ReadMilestones](/api/capi/gamification/readmilestones)
-   [ReadMilestonesByCategory](/api/capi/gamification/readmilestonesbycategory)
-   [ReadInProgressMilestones](/api/capi/gamification/readinprogressmilestones)
-   [ReadCompletedMilestones](/api/capi/gamification/readcompletedmilestones)

### Milestone Management

_The Milestone Management APIs are available from cloud-code only._

-   [SysCreateMilestone](/api/capi/gamification/syscreatemilestone)
-   [SysDeleteMilestone](/api/capi/gamification/sysdeletemilestone)
-   [SysReadMilestone](/api/capi/gamification/sysreadmilestone)
-   [SysUpdateMilestone](/api/capi/gamification/sysupdatemilestone)

-   [SysGetMilestonePage](/api/capi/gamification/sysgetmilestonepage)
-   [SysGetMilestonePageOffset](/api/capi/gamification/sysgetmilestonepageoffset)

### Quests

-   [ReadQuests](/api/capi/gamification/readquests)
-   [ReadQuestsByCategory](/api/capi/gamification/readquestsbycategory)
-   [ReadQuestsWithStatus](/api/capi/gamification/readquestswithstatus)
-   [ReadQuestsWithBasicPercentage](/api/capi/gamification/readquestswithbasicpercentage)
-   [ReadQuestsWithComplexPercentage](/api/capi/gamification/readquestswithcomplexpercentage)
-   [ReadNotStartedQuests](/api/capi/gamification/readnotstartedquests)
-   [ReadInProgressQuests](/api/capi/gamification/readinprogressquests)
-   [ReadCompletedQuests](/api/capi/gamification/readcompletedquests)

### Quest Management

_The Quest Management APIs are available from cloud-code only._

-   [SysCreateQuest](/api/capi/gamification/syscreatequest)
-   [SysDeleteQuest](/api/capi/gamification/sysdeletequest)
-   [SysReadQuest](/api/capi/gamification/sysreadquest)
-   [SysUpdateQuest](/api/capi/gamification/sysupdatequest)

-   [SysAddQuestTask](/api/capi/gamification/sysaddquesttask)
-   [SysDeleteQuestTask](/api/capi/gamification/sysdeletequesttask)
-   [SysReorderQuestTasks](/api/capi/gamification/sysreorderquesttasks)
-   [SysUpdateQuestTask](/api/capi/gamification/sysupdatequesttask)

-   [SysGetQuestPage](/api/capi/gamification/sysgetquestpage)
-   [SysGetQuestPageOffset](/api/capi/gamification/sysgetquestpageoffset)

### Resetting Milestone/Quest Status (useful when debugging)

_The Rest APIs are available from cloud-code only._

-   [ResetMilestones](/api/capi/gamification/resetmilestones)
-   [ResetQuests](/api/capi/gamification/resetquests)
-   [ResetAllQuestsAndMilestones](/api/capi/gamification/resetallquestsandmilestones)


---

<!-- source: docs/api/2_capi/gamification/readachievedachievements.md -->
<!-- url: https://docs.braincloudservers.com/api/capi/gamification/readachievedachievements -->

# ReadAchievedAchievements

Method retrieves the list of achieved achievements.

| Service | Operation |
| ------- | --------- |
| gamification | READ_ACHIEVED_ACHIEVEMENTS |

## Method Parameters
Parameter | Description
--------- | -----------
includeMetaData | Whether to return meta data as well

## Usage

**C#:**

```csharp
bool includeMetaData = false;
SuccessCallback successCallback = (response, cbObject) =>
{
    Debug.Log(string.Format("Success | {0}", response));
};
FailureCallback failureCallback = (status, code, error, cbObject) =>
{
    Debug.Log(string.Format("Failed | {0}  {1}  {2}", status, code, error));
};

_bc.GamificationService.ReadAchievedAchievements(includeMetaData, successCallback, failureCallback);
```

**C++:**

```cpp
bool includeMetaData = false;
_bc->getGamificationService()->readAchievedAchievements(includeMetaData, this);
```

**Obj-C:**

```objectivec
bool includeMetaData = false;
BCCompletionBlock successBlock;      // define callback
BCErrorCompletionBlock failureBlock; // define callback

[[_bc gamificationService] readAchievedAchievements:includeMetaData
            completionBlock:successBlock
       errorCompletionBlock:failureBlock
                   cbObject:nil];
```

**Java:**

```java
boolean includeMetaData = false;
this; // implements IServerCallback

_bc.getGamificationService().readAchievedAchievements(includeMetaData, this);

public void serverCallback(ServiceName serviceName, ServiceOperation serviceOperation, JSONObject jsonData)
{
    System.out.print(String.format("Success | %s", jsonData.toString()));
}
public void serverError(ServiceName serviceName, ServiceOperation serviceOperation, int statusCode, int reasonCode, String jsonError)
{
    System.out.print(String.format("Failed | %d %d %s", statusCode,  reasonCode, jsonError.toString()));
}
```

**JavaScript:**

```javascript
var includeMetaData = false;

_bc.gamification.readAchievedAchievements(includeMetaData, result =>
{
    var status = result.status;
    console.log(status + " : " + JSON.stringify(result, null, 2));
});
```

**Dart:**

```dart
var  includeMetaData = false;

ServerResponse result = await _bc.gamificationService.readAchievedAchievements(includeMetaData:includeMetaData);

if (result.statusCode == 200) {
    print("Success");
} else {
    print("Failed ${result.error['status_message'] ?? result.error}");
}
```

**Roblox:**

```lua
local includeMetaData = false

local callback = function(success, response)
    if success then
        print("Success")
    else
        print("Failed | " .. tostring(response.status_message))
    end
end

_bc.gamification:readAchievedAchievements(callback, includeMetaData)
```

**GDScript:**

```gdscript
var include_meta_data = false

var result = await _bc.gamification_service.read_achieved_achievements(include_meta_data)

if result.status == 200:
	print("Success")
else:
	print("Failed: %s" % result.status_message)
```

**Lua:**

```lua
local includeMetaData = false

local callback = function(success, response)
    if success then
        print("Success")
    else
        print("Failed | " .. tostring(response.status_message))
    end
end

_bc.gamification:readAchievedAchievements(callback, includeMetaData)
```

**Cloud Code:**

```cfscript
var includeMetaData = false;
var gamificationProxy = bridge.getGamificationServiceProxy();

var postResult = gamificationProxy.readAchievedAchievements(includeMetaData);
if (postResult.status == 200) {
    // Success!
}
```

**Raw:**

```r
{
    "service": "gamification",
    "operation": "READ_ACHIEVED_ACHIEVEMENTS",
    "data": {
        "includeMetaData": false
    }
}
```

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

```json
{
    "data": {
        "achievements": []
    },
    "status": 200
}
```
</details>


---

<!-- source: docs/api/2_capi/gamification/readachievements.md -->
<!-- url: https://docs.braincloudservers.com/api/capi/gamification/readachievements -->

# ReadAchievements

Read all of the achievements defined for the game.

| Service | Operation |
| ------- | --------- |
| gamification | READ_ACHIEVEMENTS |

## Method Parameters
Parameter | Description
--------- | -----------
includeMetaData | Whether to return meta data as well

## Usage

**C#:**

```csharp
bool includeMetaData = false;
SuccessCallback successCallback = (response, cbObject) =>
{
    Debug.Log(string.Format("Success | {0}", response));
};
FailureCallback failureCallback = (status, code, error, cbObject) =>
{
    Debug.Log(string.Format("Failed | {0}  {1}  {2}", status, code, error));
};

_bc.GamificationService.ReadAchievements(includeMetaData, successCallback, failureCallback);
```

**C++:**

```cpp
bool includeMetaData = false;
_bc->getGamificationService()->readAchievements(includeMetaData, this);
```

**Obj-C:**

```objectivec
bool includeMetaData = false;
BCCompletionBlock successBlock;      // define callback
BCErrorCompletionBlock failureBlock; // define callback

[[_bc gamificationService] readAchievements:includeMetaData
            completionBlock:successBlock
       errorCompletionBlock:failureBlock
                   cbObject:nil];
```

**Java:**

```java
boolean includeMetaData = false;
this; // implements IServerCallback

_bc.getGamificationService().readAchievements(includeMetaData, this);

public void serverCallback(ServiceName serviceName, ServiceOperation serviceOperation, JSONObject jsonData)
{
    System.out.print(String.format("Success | %s", jsonData.toString()));
}
public void serverError(ServiceName serviceName, ServiceOperation serviceOperation, int statusCode, int reasonCode, String jsonError)
{
    System.out.print(String.format("Failed | %d %d %s", statusCode,  reasonCode, jsonError.toString()));
}
```

**JavaScript:**

```javascript
var includeMetaData = false;

_bc.gamification.readAchievements(includeMetaData, result =>
{
    var status = result.status;
    console.log(status + " : " + JSON.stringify(result, null, 2));
});
```

**Dart:**

```dart
var  includeMetaData = false;

ServerResponse result = await _bc.gamificationService.readAchievements(includeMetaData:includeMetaData);

if (result.statusCode == 200) {
    print("Success");
} else {
    print("Failed ${result.error['status_message'] ?? result.error}");
}
```

**Roblox:**

```lua
local includeMetaData = false

local callback = function(success, response)
    if success then
        print("Success")
    else
        print("Failed | " .. tostring(response.status_message))
    end
end

_bc.gamification:readAchievements(callback, includeMetaData)
```

**GDScript:**

```gdscript
var include_meta_data = false

var result = await _bc.gamification_service.read_achievements(include_meta_data)

if result.status == 200:
	print("Success")
else:
	print("Failed: %s" % result.status_message)
```

**Lua:**

```lua
local includeMetaData = false

local callback = function(success, response)
    if success then
        print("Success")
    else
        print("Failed | " .. tostring(response.status_message))
    end
end

_bc.gamification:readAchievements(callback, includeMetaData)
```

**Cloud Code:**

```cfscript
var includeMetaData = false;
var gamificationProxy = bridge.getGamificationServiceProxy();

var postResult = gamificationProxy.readAchievements(includeMetaData);
if (postResult.status == 200) {
    // Success!
}
```

**Raw:**

```r
{
    "service": "gamification",
    "operation": "READ_ACHIEVEMENTS",
    "data": {
        "includeMetaData": false
    }
}
```

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

```json
{
    "data": {
        "achievements": [
            {
                "fbEnabled": false,
                "imageUrl": "https://api.braincloudservers.com/s3/portal/g/123456/metadata/achievements/testAchievement01.png",
                "status": "NOT_AWARDED",
                "gameId": "20001",
                "steamEnabled": false,
                "extraData": null,
                "achievementId": "testAchievement01",
                "invisibleUntilEarned": false,
                "steamAchievementId": null,
                "id": "testAchievement01",
                "appleEnabled": false,
                "title": "Test Achievement 1",
                "fbGamePoints": null,
                "description": "Test description.",
                "appleAchievementId": null
            }
        ]
    },
    "status": 200
}
```
</details>


---

<!-- source: docs/api/2_capi/gamification/readallgamification.md -->
<!-- url: https://docs.braincloudservers.com/api/capi/gamification/readallgamification -->

# ReadAllGamification

Method retrieves all gamification data for the player.

| Service | Operation |
| ------- | --------- |
| gamification | READ |

## Method Parameters
Parameter | Description
--------- | -----------
includeMetaData | Whether to return meta data as well

## Usage

**C#:**

```csharp
bool includeMetaData = false;
SuccessCallback successCallback = (response, cbObject) =>
{
    Debug.Log(string.Format("Success | {0}", response));
};
FailureCallback failureCallback = (status, code, error, cbObject) =>
{
    Debug.Log(string.Format("Failed | {0}  {1}  {2}", status, code, error));
};

_bc.GamificationService.ReadAllGamification(includeMetaData, successCallback, failureCallback);
```

**C++:**

```cpp
bool includeMetaData = false;
_bc->getGamificationService()->readAllGamification(includeMetaData, this);
```

**Obj-C:**

```objectivec
bool includeMetaData = false;
BCCompletionBlock successBlock;      // define callback
BCErrorCompletionBlock failureBlock; // define callback

[[_bc gamificationService] readAllGamification:includeMetaData
            completionBlock:successBlock
       errorCompletionBlock:failureBlock
                   cbObject:nil];
```

**Java:**

```java
boolean includeMetaData = false;
this; // implements IServerCallback

_bc.getGamificationService().readAllGamification(includeMetaData, this);

public void serverCallback(ServiceName serviceName, ServiceOperation serviceOperation, JSONObject jsonData)
{
    System.out.print(String.format("Success | %s", jsonData.toString()));
}
public void serverError(ServiceName serviceName, ServiceOperation serviceOperation, int statusCode, int reasonCode, String jsonError)
{
    System.out.print(String.format("Failed | %d %d %s", statusCode,  reasonCode, jsonError.toString()));
}
```

**JavaScript:**

```javascript
var includeMetaData = false;

_bc.gamification.readAllGamification(includeMetaData, result =>
{
    var status = result.status;
    console.log(status + " : " + JSON.stringify(result, null, 2));
});
```

**Dart:**

```dart
var  includeMetaData = false;

ServerResponse result = await _bc.gamificationService.readAllGamification(includeMetaData:includeMetaData);

if (result.statusCode == 200) {
    print("Success");
} else {
    print("Failed ${result.error['status_message'] ?? result.error}");
}
```

**Roblox:**

```lua
local includeMetaData = false

local callback = function(success, response)
    if success then
        print("Success")
    else
        print("Failed | " .. tostring(response.status_message))
    end
end

_bc.gamification:readAllGamification(callback, includeMetaData)
```

**GDScript:**

```gdscript
var include_meta_data = false

var result = await _bc.gamification_service.read_all_gamification(include_meta_data)

if result.status == 200:
	print("Success")
else:
	print("Failed: %s" % result.status_message)
```

**Lua:**

```lua
local includeMetaData = false

local callback = function(success, response)
    if success then
        print("Success")
    else
        print("Failed | " .. tostring(response.status_message))
    end
end

_bc.gamification:readAllGamification(callback, includeMetaData)
```

**Cloud Code:**

```cfscript
var includeMetaData = false;
var gamificationProxy = bridge.getGamificationServiceProxy();

var postResult = gamificationProxy.readAllGamification(includeMetaData);
if (postResult.status == 200) {
    // Success!
}
```

**Raw:**

```r
{
    "service": "gamification",
    "operation": "READ",
    "data": {
        "includeMetaData": false
    }
}
```

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

```json
{
    "data": {
        "milestones": [
            {
                "id": "milestone01",
                "category": "general",
                "title": "Level 2 milestone",
                "status": "SATISFIED",
                "description": "Awarded when you get to level 2",
                "gameId": "10068",
                "rewards": {
                    "currency": {
                        "gold": 1000
                    }
                },
                "extraData": null,
                "questId": null
            }
        ],
        "achievements": [
            {
                "fbEnabled": true,
                "imageUrl": null,
                "status": "NOT_AWARDED",
                "gameId": "10068",
                "steamEnabled": false,
                "extraData": null,
                "achievementId": "ach01",
                "invisibleUntilEarned": false,
                "steamAchievementId": "",
                "id": "ach01",
                "appleEnabled": false,
                "title": "Finish Tutorial",
                "fbGamePoints": 10,
                "description": "Achievement awarded when you finish the tutorial",
                "appleAchievementId": ""
            }
        ],
        "quests": [],
        "xp": {
            "xpCapped": false,
            "experiencePoints": 0,
            "xpLevel": {
                "gameId": "10068",
                "level": 0,
                "statusTitle": "Lesser",
                "experience": 0,
                "fbAction": ""
            },
            "experienceLevel": 0
        }
    },
    "status": 200
}
```
</details>


---

<!-- source: docs/api/2_capi/gamification/readcompletedmilestones.md -->
<!-- url: https://docs.braincloudservers.com/api/capi/gamification/readcompletedmilestones -->

# ReadCompletedMilestones

Method retrieves the list of completed milestones

| Service | Operation |
| ------- | --------- |
| gamification | READ_COMPLETED_MILESTONES |

## Method Parameters
Parameter | Description
--------- | -----------
includeMetaData | Whether to return meta data as well

## Usage

**C#:**

```csharp
bool includeMetaData = false;
SuccessCallback successCallback = (response, cbObject) =>
{
    Debug.Log(string.Format("Success | {0}", response));
};
FailureCallback failureCallback = (status, code, error, cbObject) =>
{
    Debug.Log(string.Format("Failed | {0}  {1}  {2}", status, code, error));
};

_bc.GamificationService.ReadCompletedMilestones(includeMetaData, successCallback, failureCallback);
```

**C++:**

```cpp
bool includeMetaData = false;
_bc->getGamificationService()->readCompletedMilestones(includeMetaData, this);
```

**Obj-C:**

```objectivec
bool includeMetaData = false;
BCCompletionBlock successBlock;      // define callback
BCErrorCompletionBlock failureBlock; // define callback

[[_bc gamificationService] readCompletedMilestones:includeMetaData
            completionBlock:successBlock
       errorCompletionBlock:failureBlock
                   cbObject:nil];
```

**Java:**

```java
boolean includeMetaData = false;
this; // implements IServerCallback

_bc.getGamificationService().readCompletedMilestones(includeMetaData, this);

public void serverCallback(ServiceName serviceName, ServiceOperation serviceOperation, JSONObject jsonData)
{
    System.out.print(String.format("Success | %s", jsonData.toString()));
}
public void serverError(ServiceName serviceName, ServiceOperation serviceOperation, int statusCode, int reasonCode, String jsonError)
{
    System.out.print(String.format("Failed | %d %d %s", statusCode,  reasonCode, jsonError.toString()));
}
```

**JavaScript:**

```javascript
var includeMetaData = false;

_bc.gamification.readCompletedMilestones(includeMetaData, result =>
{
    var status = result.status;
    console.log(status + " : " + JSON.stringify(result, null, 2));
});
```

**Dart:**

```dart
var  includeMetaData = false;

ServerResponse result = await _bc.gamificationService.readCompletedMilestones(includeMetaData:includeMetaData);

if (result.statusCode == 200) {
    print("Success");
} else {
    print("Failed ${result.error['status_message'] ?? result.error}");
}
```

**Roblox:**

```lua
local includeMetaData = false

local callback = function(success, response)
    if success then
        print("Success")
    else
        print("Failed | " .. tostring(response.status_message))
    end
end

_bc.gamification:readCompletedMilestones(callback, includeMetaData)
```

**GDScript:**

```gdscript
N/A
```

**Lua:**

```lua
local includeMetaData = false

local callback = function(success, response)
    if success then
        print("Success")
    else
        print("Failed | " .. tostring(response.status_message))
    end
end

_bc.gamification:readCompletedMilestones(callback, includeMetaData)
```

**Cloud Code:**

```cfscript
var includeMetaData = false;
var gamificationProxy = bridge.getGamificationServiceProxy();

var postResult = gamificationProxy.readCompletedMilestones(includeMetaData);
if (postResult.status == 200) {
    // Success!
}
```

**Raw:**

```r
{
    "service": "gamification",
    "operation": "READ_COMPLETED_MILESTONES",
    "data": {
        "includeMetaData": false
    }
}
```

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

```json
{
    "data" :
    {
        "milestones": []
    },
    "status" : 200
}
```
</details>


---

<!-- source: docs/api/2_capi/gamification/readcompletedquests.md -->
<!-- url: https://docs.braincloudservers.com/api/capi/gamification/readcompletedquests -->

# ReadCompletedQuests

Method returns all completed quests.

| Service | Operation |
| ------- | --------- |
| gamification | READ_COMPLETED_QUESTS |

## Method Parameters
Parameter | Description
--------- | -----------
includeMetaData | Whether to return meta data as well

## Usage

**C#:**

```csharp
bool includeMetaData = false;
SuccessCallback successCallback = (response, cbObject) =>
{
    Debug.Log(string.Format("Success | {0}", response));
};
FailureCallback failureCallback = (status, code, error, cbObject) =>
{
    Debug.Log(string.Format("Failed | {0}  {1}  {2}", status, code, error));
};

_bc.GamificationService.ReadCompletedQuests(includeMetaData, successCallback, failureCallback);
```

**C++:**

```cpp
bool includeMetaData = false;
_bc->getGamificationService()->readCompletedQuests(includeMetaData, this);
```

**Obj-C:**

```objectivec
bool includeMetaData = false;
BCCompletionBlock successBlock;      // define callback
BCErrorCompletionBlock failureBlock; // define callback

[[_bc gamificationService] readCompletedQuests:includeMetaData
            completionBlock:successBlock
       errorCompletionBlock:failureBlock
                   cbObject:nil];
```

**Java:**

```java
boolean includeMetaData = false;
this; // implements IServerCallback

_bc.getGamificationService().readCompletedQuests(includeMetaData, this);

public void serverCallback(ServiceName serviceName, ServiceOperation serviceOperation, JSONObject jsonData)
{
    System.out.print(String.format("Success | %s", jsonData.toString()));
}
public void serverError(ServiceName serviceName, ServiceOperation serviceOperation, int statusCode, int reasonCode, String jsonError)
{
    System.out.print(String.format("Failed | %d %d %s", statusCode,  reasonCode, jsonError.toString()));
}
```

**JavaScript:**

```javascript
var includeMetaData = false;

_bc.gamification.readCompletedQuests(includeMetaData, result =>
{
    var status = result.status;
    console.log(status + " : " + JSON.stringify(result, null, 2));
});
```

**Dart:**

```dart
var  includeMetaData = false;

ServerResponse result = await _bc.gamificationService.readCompletedQuests(includeMetaData:includeMetaData);

if (result.statusCode == 200) {
    print("Success");
} else {
    print("Failed ${result.error['status_message'] ?? result.error}");
}
```

**Roblox:**

```lua
local includeMetaData = false

local callback = function(success, response)
    if success then
        print("Success")
    else
        print("Failed | " .. tostring(response.status_message))
    end
end

_bc.gamification:readCompletedQuests(callback, includeMetaData)
```

**GDScript:**

```gdscript
var include_meta_data = false

var result = await _bc.gamification_service.read_completed_quests(include_meta_data)

if result.status == 200:
	print("Success")
else:
	print("Failed: %s" % result.status_message)
```

**Lua:**

```lua
local includeMetaData = false

local callback = function(success, response)
    if success then
        print("Success")
    else
        print("Failed | " .. tostring(response.status_message))
    end
end

_bc.gamification:readCompletedQuests(callback, includeMetaData)
```

**Cloud Code:**

```cfscript
var includeMetaData = false;
var gamificationProxy = bridge.getGamificationServiceProxy();

var postResult = gamificationProxy.readCompletedQuests(includeMetaData);
if (postResult.status == 200) {
    // Success!
}
```

**Raw:**

```r
{
    "service": "gamification",
    "operation": "READ_COMPLETED_QUESTS",
    "data": {
        "includeMetaData": false
    }
}
```

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

```json
{
    "data" :
    {
        "quests": []
    },
    "status" : 200
}
```
</details>


---

<!-- source: docs/api/2_capi/gamification/readinprogressmilestones.md -->
<!-- url: https://docs.braincloudservers.com/api/capi/gamification/readinprogressmilestones -->

# ReadInProgressMilestones

Method retrieves the list of in progress milestones.

| Service | Operation |
| ------- | --------- |
| gamification | READ_IN_PROGRESS_MILESTONES |

## Method Parameters
Parameter | Description
--------- | -----------
includeMetaData | Whether to return meta data as well

## Usage

**C#:**

```csharp
bool includeMetaData = false;
SuccessCallback successCallback = (response, cbObject) =>
{
    Debug.Log(string.Format("Success | {0}", response));
};
FailureCallback failureCallback = (status, code, error, cbObject) =>
{
    Debug.Log(string.Format("Failed | {0}  {1}  {2}", status, code, error));
};

_bc.GamificationService.ReadInProgressMilestones(includeMetaData, successCallback, failureCallback);
```

**C++:**

```cpp
bool includeMetaData = false;
_bc->getGamificationService()->readInProgressMilestones(includeMetaData, this);
```

**Obj-C:**

```objectivec
bool includeMetaData = false;
BCCompletionBlock successBlock;      // define callback
BCErrorCompletionBlock failureBlock; // define callback

[[_bc gamificationService] readInProgressMilestones:includeMetaData
            completionBlock:successBlock
       errorCompletionBlock:failureBlock
                   cbObject:nil];
```

**Java:**

```java
boolean includeMetaData = false;
this; // implements IServerCallback

_bc.getGamificationService().readInProgressMilestones(includeMetaData, this);

public void serverCallback(ServiceName serviceName, ServiceOperation serviceOperation, JSONObject jsonData)
{
    System.out.print(String.format("Success | %s", jsonData.toString()));
}
public void serverError(ServiceName serviceName, ServiceOperation serviceOperation, int statusCode, int reasonCode, String jsonError)
{
    System.out.print(String.format("Failed | %d %d %s", statusCode,  reasonCode, jsonError.toString()));
}
```

**JavaScript:**

```javascript
var includeMetaData = false;

_bc.gamification.readInProgressMilestones(includeMetaData, result =>
{
    var status = result.status;
    console.log(status + " : " + JSON.stringify(result, null, 2));
});
```

**Dart:**

```dart
var  includeMetaData = false;

ServerResponse result = await _bc.gamificationService.readInProgressMilestones(includeMetaData:includeMetaData);

if (result.statusCode == 200) {
    print("Success");
} else {
    print("Failed ${result.error['status_message'] ?? result.error}");
}
```

**Roblox:**

```lua
local includeMetaData = false

local callback = function(success, response)
    if success then
        print("Success")
    else
        print("Failed | " .. tostring(response.status_message))
    end
end

_bc.gamification:readInProgressMilestones(callback, includeMetaData)
```

**GDScript:**

```gdscript
N/A
```

**Lua:**

```lua
local includeMetaData = false

local callback = function(success, response)
    if success then
        print("Success")
    else
        print("Failed | " .. tostring(response.status_message))
    end
end

_bc.gamification:readInProgressMilestones(callback, includeMetaData)
```

**Cloud Code:**

```cfscript
var includeMetaData = false;
var gamificationProxy = bridge.getGamificationServiceProxy();

var postResult = gamificationProxy.readInProgressMilestones(includeMetaData);
if (postResult.status == 200) {
    // Success!
}
```

**Raw:**

```r
{
    "service": "gamification",
    "operation": "READ_IN_PROGRESS_MILESTONES",
    "data": {
        "includeMetaData": false
    }
}
```

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

```json
{
    "data": {
        "milestones": [
            {
                "gameId": "11549",
                "questId": null,
                "thresholds": {
                    "playerStatistics": {
                        "statistics": {
                            "Plane_Shot_Down": 50
                        }
                    }
                },
                "extraData": null,
                "description": "Awarded for shooting down 50 enemy planes.",
                "id": "6",
                "title": "Sky Ace",
                "category": "Game_Milestones",
                "status": "IN_PROGRESS"
            }
        ]
    },
    "status": 200
}
```
</details>


---

<!-- source: docs/api/2_capi/gamification/readinprogressquests.md -->
<!-- url: https://docs.braincloudservers.com/api/capi/gamification/readinprogressquests -->

# ReadInProgressQuests

Method returns quests that are in progress.

| Service | Operation |
| ------- | --------- |
| gamification | READ_IN_PROGRESS_QUESTS |

## Method Parameters
Parameter | Description
--------- | -----------
includeMetaData | Whether to return meta data as well

## Usage

**C#:**

```csharp
bool includeMetaData = false;
SuccessCallback successCallback = (response, cbObject) =>
{
    Debug.Log(string.Format("Success | {0}", response));
};
FailureCallback failureCallback = (status, code, error, cbObject) =>
{
    Debug.Log(string.Format("Failed | {0}  {1}  {2}", status, code, error));
};

_bc.GamificationService.ReadInProgressQuests(includeMetaData, successCallback, failureCallback);
```

**C++:**

```cpp
bool includeMetaData = false;
_bc->getGamificationService()->readInProgressQuests(includeMetaData, this);
```

**Obj-C:**

```objectivec
bool includeMetaData = false;
BCCompletionBlock successBlock;      // define callback
BCErrorCompletionBlock failureBlock; // define callback

[[_bc gamificationService] readInProgressQuests:includeMetaData
            completionBlock:successBlock
       errorCompletionBlock:failureBlock
                   cbObject:nil];
```

**Java:**

```java
boolean includeMetaData = false;
this; // implements IServerCallback

_bc.getGamificationService().readInProgressQuests(includeMetaData, this);

public void serverCallback(ServiceName serviceName, ServiceOperation serviceOperation, JSONObject jsonData)
{
    System.out.print(String.format("Success | %s", jsonData.toString()));
}
public void serverError(ServiceName serviceName, ServiceOperation serviceOperation, int statusCode, int reasonCode, String jsonError)
{
    System.out.print(String.format("Failed | %d %d %s", statusCode,  reasonCode, jsonError.toString()));
}
```

**JavaScript:**

```javascript
var includeMetaData = false;

_bc.gamification.readInProgressQuests(includeMetaData, result =>
{
    var status = result.status;
    console.log(status + " : " + JSON.stringify(result, null, 2));
});
```

**Dart:**

```dart
var  includeMetaData = false;

ServerResponse result = await _bc.gamificationService.readInProgressQuests(includeMetaData:includeMetaData);

if (result.statusCode == 200) {
    print("Success");
} else {
    print("Failed ${result.error['status_message'] ?? result.error}");
}
```

**Roblox:**

```lua
local includeMetaData = false

local callback = function(success, response)
    if success then
        print("Success")
    else
        print("Failed | " .. tostring(response.status_message))
    end
end

_bc.gamification:readInProgressQuests(callback, includeMetaData)
```

**GDScript:**

```gdscript
var include_meta_data = false

var result = await _bc.gamification_service.read_in_progress_quests(include_meta_data)

if result.status == 200:
	print("Success")
else:
	print("Failed: %s" % result.status_message)
```

**Lua:**

```lua
local includeMetaData = false

local callback = function(success, response)
    if success then
        print("Success")
    else
        print("Failed | " .. tostring(response.status_message))
    end
end

_bc.gamification:readInProgressQuests(callback, includeMetaData)
```

**Cloud Code:**

```cfscript
var includeMetaData = false;
var gamificationProxy = bridge.getGamificationServiceProxy();

var postResult = gamificationProxy.readInProgressQuests(includeMetaData);
if (postResult.status == 200) {
    // Success!
}
```

**Raw:**

```r
{
    "service": "gamification",
    "operation": "READ_IN_PROGRESS_QUESTS",
    "data": {
        "includeMetaData": false
    }
}
```

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

```json
{
    "data" :
    {
        "quests": []
    },
    "status" : 200
}
```
</details>


---

<!-- source: docs/api/2_capi/gamification/readmilestones.md -->
<!-- url: https://docs.braincloudservers.com/api/capi/gamification/readmilestones -->

# ReadMilestones

Method retrieves all milestones defined for the game.

| Service | Operation |
| ------- | --------- |
| gamification | READ_MILESTONES |

## Method Parameters
Parameter | Description
--------- | -----------
includeMetaData | Whether to return meta data as well

## Usage

**C#:**

```csharp
bool includeMetaData = false;
SuccessCallback successCallback = (response, cbObject) =>
{
    Debug.Log(string.Format("Success | {0}", response));
};
FailureCallback failureCallback = (status, code, error, cbObject) =>
{
    Debug.Log(string.Format("Failed | {0}  {1}  {2}", status, code, error));
};

_bc.GamificationService.ReadMilestones(includeMetaData, successCallback, failureCallback);
```

**C++:**

```cpp
bool includeMetaData = false;
_bc->getGamificationService()->readMilestones(includeMetaData, this);
```

**Obj-C:**

```objectivec
bool includeMetaData = false;
BCCompletionBlock successBlock;      // define callback
BCErrorCompletionBlock failureBlock; // define callback

[[_bc gamificationService] readMilestones:includeMetaData
            completionBlock:successBlock
       errorCompletionBlock:failureBlock
                   cbObject:nil];
```

**Java:**

```java
boolean includeMetaData = false;
this; // implements IServerCallback

_bc.getGamificationService().readMilestones(includeMetaData, this);

public void serverCallback(ServiceName serviceName, ServiceOperation serviceOperation, JSONObject jsonData)
{
    System.out.print(String.format("Success | %s", jsonData.toString()));
}
public void serverError(ServiceName serviceName, ServiceOperation serviceOperation, int statusCode, int reasonCode, String jsonError)
{
    System.out.print(String.format("Failed | %d %d %s", statusCode,  reasonCode, jsonError.toString()));
}
```

**JavaScript:**

```javascript
var includeMetaData = false;

_bc.gamification.readMilestones(includeMetaData, result =>
{
    var status = result.status;
    console.log(status + " : " + JSON.stringify(result, null, 2));
});
```

**Dart:**

```dart
var  includeMetaData = false;

ServerResponse result = await _bc.gamificationService.readMilestones(includeMetaData:includeMetaData);

if (result.statusCode == 200) {
    print("Success");
} else {
    print("Failed ${result.error['status_message'] ?? result.error}");
}
```

**Roblox:**

```lua
local includeMetaData = false

local callback = function(success, response)
    if success then
        print("Success")
    else
        print("Failed | " .. tostring(response.status_message))
    end
end

_bc.gamification:readMilestones(callback, includeMetaData)
```

**GDScript:**

```gdscript
var include_meta_data = false

var result = await _bc.gamification_service.read_milestones(include_meta_data)

if result.status == 200:
	print("Success")
else:
	print("Failed: %s" % result.status_message)
```

**Lua:**

```lua
local includeMetaData = false

local callback = function(success, response)
    if success then
        print("Success")
    else
        print("Failed | " .. tostring(response.status_message))
    end
end

_bc.gamification:readMilestones(callback, includeMetaData)
```

**Cloud Code:**

```cfscript
var includeMetaData = false;
var gamificationProxy = bridge.getGamificationServiceProxy();

var postResult = gamificationProxy.readMilestones(includeMetaData);
if (postResult.status == 200) {
    // Success!
}
```

**Raw:**

```r
{
    "service": "gamification",
    "operation": "READ_MILESTONES",
    "data": {
        "includeMetaData": false
    }
}
```

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

```json
{
    "data": {
        "milestones": [
            {
                "gameId": "11549",
                "questId": null,
                "thresholds": {
                    "playerStatistics": {
                        "experienceLevel": 1
                    }
                },
                "extraData": null,
                "unlockThresholds": {
                    "playerStatistics": {
                        "statistics": {
                            "Levels_Completed": 5
                        }
                    }
                },
                "description": "Awarded when you get to player level 1",
                "id": "3",
                "title": "Level 1 milestone",
                "category": "Level_Milestones",
                "rewards": {
                    "currency": {
                        "Gems": 10
                    }
                },
                "status": "IN_PROGRESS"
            }
        ]
    },
    "status": 200
}
```
</details>


---

<!-- source: docs/api/2_capi/gamification/readmilestonesbycategory.md -->
<!-- url: https://docs.braincloudservers.com/api/capi/gamification/readmilestonesbycategory -->

# ReadMilestonesByCategory

Method returns milestones for the given category.

| Service | Operation |
| ------- | --------- |
| gamification | READ_MILESTONES_BY_CATEGORY |

## Method Parameters
Parameter | Description
--------- | -----------
category | The milestone category
includeMetaData | Whether to return meta data as well

## Usage

**C#:**

```csharp
string category = "main";
bool includeMetaData = false;
SuccessCallback successCallback = (response, cbObject) =>
{
    Debug.Log(string.Format("Success | {0}", response));
};
FailureCallback failureCallback = (status, code, error, cbObject) =>
{
    Debug.Log(string.Format("Failed | {0}  {1}  {2}", status, code, error));
};

_bc.GamificationService.ReadMilestonesByCategory(category, includeMetaData, successCallback, failureCallback);
```

**C++:**

```cpp
const char *category = "main";
bool includeMetaData = false;
_bc->getGamificationService()->readMilestonesByCategory(category, includeMetaData, this);
```

**Obj-C:**

```objectivec
NSString *category = @"main";
bool includeMetaData = false;
BCCompletionBlock successBlock;      // define callback
BCErrorCompletionBlock failureBlock; // define callback

[[_bc gamificationService] readMilestonesByCategory:category
            includeMetaData:includeMetaData
            completionBlock:successBlock
       errorCompletionBlock:failureBlock
                   cbObject:nil];
```

**Java:**

```java
String category = "main";
boolean includeMetaData = false;
this; // implements IServerCallback

_bc.getGamificationService().readMilestonesByCategory(category, includeMetaData, this);

public void serverCallback(ServiceName serviceName, ServiceOperation serviceOperation, JSONObject jsonData)
{
    System.out.print(String.format("Success | %s", jsonData.toString()));
}
public void serverError(ServiceName serviceName, ServiceOperation serviceOperation, int statusCode, int reasonCode, String jsonError)
{
    System.out.print(String.format("Failed | %d %d %s", statusCode,  reasonCode, jsonError.toString()));
}
```

**JavaScript:**

```javascript
var category = "main";
var includeMetaData = false;

_bc.gamification.readMilestonesByCategory(category, includeMetaData, result =>
{
    var status = result.status;
    console.log(status + " : " + JSON.stringify(result, null, 2));
});
```

**Dart:**

```dart
var  category = "main";
var  includeMetaData = false;

ServerResponse result = await _bc.gamificationService.readMilestonesByCategory(category:category, includeMetaData:includeMetaData);

if (result.statusCode == 200) {
    print("Success");
} else {
    print("Failed ${result.error['status_message'] ?? result.error}");
}
```

**Roblox:**

```lua
local category = "main"
local includeMetaData = false

local callback = function(success, response)
    if success then
        print("Success")
    else
        print("Failed | " .. tostring(response.status_message))
    end
end

_bc.gamification:readMilestonesByCategory(category, callback, includeMetaData)
```

**GDScript:**

```gdscript
var category = "main"
var include_meta_data = false

var result = await _bc.gamification_service.read_milestones_by_category(category, include_meta_data)

if result.status == 200:
	print("Success")
else:
	print("Failed: %s" % result.status_message)
```

**Lua:**

```lua
local category = "main"
local includeMetaData = false

local callback = function(success, response)
    if success then
        print("Success")
    else
        print("Failed | " .. tostring(response.status_message))
    end
end

_bc.gamification:readMilestonesByCategory(category, callback, includeMetaData)
```

**Cloud Code:**

```cfscript
var category = "main";
var includeMetaData = false;
var gamificationProxy = bridge.getGamificationServiceProxy();

var postResult = gamificationProxy.readMilestonesByCategory(category, includeMetaData);
if (postResult.status == 200) {
    // Success!
}
```

**Raw:**

```r
{
    "service": "gamification",
    "operation": "READ_MILESTONES_BY_CATEGORY",
    "data": {
        "category": "main",
        "includeMetaData": false
    }
}
```

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

```json
{
    "data" :
    {
        "milestones": []
    },
    "status" : 200
}
```
</details>


---

<!-- source: docs/api/2_capi/gamification/readnotstartedquests.md -->
<!-- url: https://docs.braincloudservers.com/api/capi/gamification/readnotstartedquests -->

# ReadNotStartedQuests

Method returns quests that have not been started.

| Service | Operation |
| ------- | --------- |
| gamification | READ_NOT_STARTED_QUESTS |

## Method Parameters
Parameter | Description
--------- | -----------
includeMetaData | Whether to return meta data as well

## Usage

**C#:**

```csharp
bool includeMetaData = false;
SuccessCallback successCallback = (response, cbObject) =>
{
    Debug.Log(string.Format("Success | {0}", response));
};
FailureCallback failureCallback = (status, code, error, cbObject) =>
{
    Debug.Log(string.Format("Failed | {0}  {1}  {2}", status, code, error));
};

_bc.GamificationService.ReadNotStartedQuests(includeMetaData, successCallback, failureCallback);
```

**C++:**

```cpp
bool includeMetaData = false;
_bc->getGamificationService()->readNotStartedQuests(includeMetaData, this);
```

**Obj-C:**

```objectivec
bool includeMetaData = false;
BCCompletionBlock successBlock;      // define callback
BCErrorCompletionBlock failureBlock; // define callback

[[_bc gamificationService] readNotStartedQuests:includeMetaData
            completionBlock:successBlock
       errorCompletionBlock:failureBlock
                   cbObject:nil];
```

**Java:**

```java
boolean includeMetaData = false;
this; // implements IServerCallback

_bc.getGamificationService().readNotStartedQuests(includeMetaData, this);

public void serverCallback(ServiceName serviceName, ServiceOperation serviceOperation, JSONObject jsonData)
{
    System.out.print(String.format("Success | %s", jsonData.toString()));
}
public void serverError(ServiceName serviceName, ServiceOperation serviceOperation, int statusCode, int reasonCode, String jsonError)
{
    System.out.print(String.format("Failed | %d %d %s", statusCode,  reasonCode, jsonError.toString()));
}
```

**JavaScript:**

```javascript
var includeMetaData = false;

_bc.gamification.readNotStartedQuests(includeMetaData, result =>
{
    var status = result.status;
    console.log(status + " : " + JSON.stringify(result, null, 2));
});
```

**Dart:**

```dart
var  includeMetaData = false;

ServerResponse result = await _bc.gamificationService.readNotStartedQuests(includeMetaData:includeMetaData);

if (result.statusCode == 200) {
    print("Success");
} else {
    print("Failed ${result.error['status_message'] ?? result.error}");
}
```

**Roblox:**

```lua
local includeMetaData = false

local callback = function(success, response)
    if success then
        print("Success")
    else
        print("Failed | " .. tostring(response.status_message))
    end
end

_bc.gamification:readNotStartedQuests(callback, includeMetaData)
```

**GDScript:**

```gdscript
N/A
```

**Lua:**

```lua
local includeMetaData = false

local callback = function(success, response)
    if success then
        print("Success")
    else
        print("Failed | " .. tostring(response.status_message))
    end
end

_bc.gamification:readNotStartedQuests(callback, includeMetaData)
```

**Cloud Code:**

```cfscript
var includeMetaData = false;
var gamificationProxy = bridge.getGamificationServiceProxy();

var postResult = gamificationProxy.readNotStartedQuests(includeMetaData);
if (postResult.status == 200) {
    // Success!
}
```

**Raw:**

```r
{
    "service": "gamification",
    "operation": "READ_NOT_STARTED_QUESTS",
    "data": {
        "includeMetaData": false
    }
}
```

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

```json
{
    "status" : 200,
    "data" :
    {
        "quests": []
    }
}
```
</details>


---

<!-- source: docs/api/2_capi/gamification/readquests.md -->
<!-- url: https://docs.braincloudservers.com/api/capi/gamification/readquests -->

# ReadQuests

Method retrieves all of the quests defined for the game.

| Service | Operation |
| ------- | --------- |
| gamification | READ_QUESTS |

## Method Parameters
Parameter | Description
--------- | -----------
includeMetaData | Whether to return meta data as well

## Usage

**C#:**

```csharp
bool includeMetaData = false;
SuccessCallback successCallback = (response, cbObject) =>
{
    Debug.Log(string.Format("Success | {0}", response));
};
FailureCallback failureCallback = (status, code, error, cbObject) =>
{
    Debug.Log(string.Format("Failed | {0}  {1}  {2}", status, code, error));
};

_bc.GamificationService.ReadQuests(includeMetaData, successCallback, failureCallback);
```

**C++:**

```cpp
bool includeMetaData = false;
_bc->getGamificationService()->readQuests(includeMetaData, this);
```

**Obj-C:**

```objectivec
bool includeMetaData = false;
BCCompletionBlock successBlock;      // define callback
BCErrorCompletionBlock failureBlock; // define callback

[[_bc gamificationService] readQuests:includeMetaData
            completionBlock:successBlock
       errorCompletionBlock:failureBlock
                   cbObject:nil];
```

**Java:**

```java
boolean includeMetaData = false;
this; // implements IServerCallback

_bc.getGamificationService().readQuests(includeMetaData, this);

public void serverCallback(ServiceName serviceName, ServiceOperation serviceOperation, JSONObject jsonData)
{
    System.out.print(String.format("Success | %s", jsonData.toString()));
}
public void serverError(ServiceName serviceName, ServiceOperation serviceOperation, int statusCode, int reasonCode, String jsonError)
{
    System.out.print(String.format("Failed | %d %d %s", statusCode,  reasonCode, jsonError.toString()));
}
```

**JavaScript:**

```javascript
var includeMetaData = false;

_bc.gamification.readQuests(includeMetaData, result =>
{
    var status = result.status;
    console.log(status + " : " + JSON.stringify(result, null, 2));
});
```

**Dart:**

```dart
var  includeMetaData = false;

ServerResponse result = await _bc.gamificationService.readQuests(includeMetaData:includeMetaData);

if (result.statusCode == 200) {
    print("Success");
} else {
    print("Failed ${result.error['status_message'] ?? result.error}");
}
```

**Roblox:**

```lua
local includeMetaData = false

local callback = function(success, response)
    if success then
        print("Success")
    else
        print("Failed | " .. tostring(response.status_message))
    end
end

_bc.gamification:readQuests(callback, includeMetaData)
```

**GDScript:**

```gdscript
N/A
```

**Lua:**

```lua
local includeMetaData = false

local callback = function(success, response)
    if success then
        print("Success")
    else
        print("Failed | " .. tostring(response.status_message))
    end
end

_bc.gamification:readQuests(callback, includeMetaData)
```

**Cloud Code:**

```cfscript
var includeMetaData = false;
var gamificationProxy = bridge.getGamificationServiceProxy();

var postResult = gamificationProxy.readQuests(includeMetaData);
if (postResult.status == 200) {
    // Success!
}
```

**Raw:**

```r
{
    "service": "gamification",
    "operation": "READ_QUESTS",
    "data": {
        "includeMetaData": false
    }
}
```

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

```json
{
    "status" : 200,
    "data" :
    {
        "quests": []
    }
}
```
</details>


---

<!-- source: docs/api/2_capi/gamification/readquestsbycategory.md -->
<!-- url: https://docs.braincloudservers.com/api/capi/gamification/readquestsbycategory -->

# ReadQuestsByCategory

Method returns quests for the given category.

| Service | Operation |
| ------- | --------- |
| gamification | READ_QUESTS_BY_CATEGORY |

## Method Parameters
Parameter | Description
--------- | -----------
category | The quest category
includeMetaData | Whether to return meta data as well

## Usage

**C#:**

```csharp
string category = "main";
bool includeMetaData = false;
SuccessCallback successCallback = (response, cbObject) =>
{
    Debug.Log(string.Format("Success | {0}", response));
};
FailureCallback failureCallback = (status, code, error, cbObject) =>
{
    Debug.Log(string.Format("Failed | {0}  {1}  {2}", status, code, error));
};

_bc.GamificationService.ReadQuestsByCategory(category, includeMetaData, successCallback, failureCallback);
```

**C++:**

```cpp
const char *category = "main";
bool includeMetaData = false;
_bc->getGamificationService()->readQuestsByCategory(category, includeMetaData, this);
```

**Obj-C:**

```objectivec
NSString *category = @"main";
bool includeMetaData = false;
BCCompletionBlock successBlock;      // define callback
BCErrorCompletionBlock failureBlock; // define callback

[[_bc gamificationService] readQuestsByCategory:category
            includeMetaData:includeMetaData
            completionBlock:successBlock
       errorCompletionBlock:failureBlock
                   cbObject:nil];
```

**Java:**

```java
String category = "main";
boolean includeMetaData = false;
this; // implements IServerCallback

_bc.getGamificationService().readQuestsByCategory(category, includeMetaData, this);

public void serverCallback(ServiceName serviceName, ServiceOperation serviceOperation, JSONObject jsonData)
{
    System.out.print(String.format("Success | %s", jsonData.toString()));
}
public void serverError(ServiceName serviceName, ServiceOperation serviceOperation, int statusCode, int reasonCode, String jsonError)
{
    System.out.print(String.format("Failed | %d %d %s", statusCode,  reasonCode, jsonError.toString()));
}
```

**JavaScript:**

```javascript
var category = "main";
var includeMetaData = false;

_bc.gamification.readQuestsByCategory(category, includeMetaData, result =>
{
    var status = result.status;
    console.log(status + " : " + JSON.stringify(result, null, 2));
});
```

**Dart:**

```dart
var  category = "main";
var  includeMetaData = false;

ServerResponse result = await _bc.gamificationService.readQuestsByCategory(category:category, includeMetaData:includeMetaData);

if (result.statusCode == 200) {
    print("Success");
} else {
    print("Failed ${result.error['status_message'] ?? result.error}");
}
```

**Roblox:**

```lua
local category = "main"
local includeMetaData = false

local callback = function(success, response)
    if success then
        print("Success")
    else
        print("Failed | " .. tostring(response.status_message))
    end
end

_bc.gamification:readQuestsByCategory(category, callback, includeMetaData)
```

**GDScript:**

```gdscript
var category = "main"
var include_meta_data = false

var result = await _bc.gamification_service.read_quests_by_category(category, include_meta_data)

if result.status == 200:
	print("Success")
else:
	print("Failed: %s" % result.status_message)
```

**Lua:**

```lua
local category = "main"
local includeMetaData = false

local callback = function(success, response)
    if success then
        print("Success")
    else
        print("Failed | " .. tostring(response.status_message))
    end
end

_bc.gamification:readQuestsByCategory(category, callback, includeMetaData)
```

**Cloud Code:**

```cfscript
var category = "main";
var includeMetaData = false;
var gamificationProxy = bridge.getGamificationServiceProxy();

var postResult = gamificationProxy.readQuestsByCategory(category, includeMetaData);
if (postResult.status == 200) {
    // Success!
}
```

**Raw:**

```r
{
    "service": "gamification",
    "operation": "READ_QUESTS_BY_CATEGORY",
    "data": {
        "category": "main",
        "includeMetaData": false
    }
}
```

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

```json
{
    "data" :
    {
        "quests": []
    },
    "status" : 200
}
```
</details>


---

<!-- source: docs/api/2_capi/gamification/readquestswithbasicpercentage.md -->
<!-- url: https://docs.braincloudservers.com/api/capi/gamification/readquestswithbasicpercentage -->

# ReadQuestsWithBasicPercentage

Method returns quests with a basic percentage.

| Service | Operation |
| ------- | --------- |
| gamification | READ_QUESTS_WITH_BASIC_PERCENTAGE |

## Method Parameters
Parameter | Description
--------- | -----------
includeMetaData | Whether to return meta data as well

## Usage

**C#:**

```csharp
bool includeMetaData = false;
SuccessCallback successCallback = (response, cbObject) =>
{
    Debug.Log(string.Format("Success | {0}", response));
};
FailureCallback failureCallback = (status, code, error, cbObject) =>
{
    Debug.Log(string.Format("Failed | {0}  {1}  {2}", status, code, error));
};

_bc.GamificationService.ReadQuestsWithBasicPercentage(includeMetaData, successCallback, failureCallback);
```

**C++:**

```cpp
bool includeMetaData = false;
_bc->getGamificationService()->readQuestsWithBasicPercentage(includeMetaData, this);
```

**Obj-C:**

```objectivec
bool includeMetaData = false;
BCCompletionBlock successBlock;      // define callback
BCErrorCompletionBlock failureBlock; // define callback

[[_bc gamificationService] readQuestsWithBasicPercentage:includeMetaData
            completionBlock:successBlock
       errorCompletionBlock:failureBlock
                   cbObject:nil];
```

**Java:**

```java
boolean includeMetaData = false;
this; // implements IServerCallback

_bc.getGamificationService().readQuestsWithBasicPercentage(includeMetaData, this);

public void serverCallback(ServiceName serviceName, ServiceOperation serviceOperation, JSONObject jsonData)
{
    System.out.print(String.format("Success | %s", jsonData.toString()));
}
public void serverError(ServiceName serviceName, ServiceOperation serviceOperation, int statusCode, int reasonCode, String jsonError)
{
    System.out.print(String.format("Failed | %d %d %s", statusCode,  reasonCode, jsonError.toString()));
}
```

**JavaScript:**

```javascript
var includeMetaData = false;

_bc.gamification.readQuestsWithBasicPercentage(includeMetaData, result =>
{
    var status = result.status;
    console.log(status + " : " + JSON.stringify(result, null, 2));
});
```

**Dart:**

```dart
var  includeMetaData = false;

ServerResponse result = await _bc.gamificationService.readQuestsWithBasicPercentage(includeMetaData:includeMetaData);

if (result.statusCode == 200) {
    print("Success");
} else {
    print("Failed ${result.error['status_message'] ?? result.error}");
}
```

**Roblox:**

```lua
local includeMetaData = false

local callback = function(success, response)
    if success then
        print("Success")
    else
        print("Failed | " .. tostring(response.status_message))
    end
end

_bc.gamification:readQuestsWithBasicPercentage(callback, includeMetaData)
```

**GDScript:**

```gdscript
N/A
```

**Lua:**

```lua
local includeMetaData = false

local callback = function(success, response)
    if success then
        print("Success")
    else
        print("Failed | " .. tostring(response.status_message))
    end
end

_bc.gamification:readQuestsWithBasicPercentage(callback, includeMetaData)
```

**Cloud Code:**

```cfscript
var includeMetaData = false;
var gamificationProxy = bridge.getGamificationServiceProxy();

var postResult = gamificationProxy.readQuestsWithBasicPercentage(includeMetaData);
if (postResult.status == 200) {
    // Success!
}
```

**Raw:**

```r
{
    "service": "gamification",
    "operation": "READ_QUESTS_WITH_BASIC_PERCENTAGE",
    "data": {
        "includeMetaData": false
    }
}
```

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

```json
{
    "data" :
    {
        "quests": []
    },
    "status" : 200
}
```
</details>


---

<!-- source: docs/api/2_capi/gamification/readquestswithcomplexpercentage.md -->
<!-- url: https://docs.braincloudservers.com/api/capi/gamification/readquestswithcomplexpercentage -->

# ReadQuestsWithComplexPercentage

Method returns quests with a complex percentage.

| Service | Operation |
| ------- | --------- |
| gamification | READ_QUESTS_WITH_COMPLEX_PERCENTAGE |

## Method Parameters
Parameter | Description
--------- | -----------
includeMetaData | Whether to return meta data as well

## Usage

**C#:**

```csharp
bool includeMetaData = false;
SuccessCallback successCallback = (response, cbObject) =>
{
    Debug.Log(string.Format("Success | {0}", response));
};
FailureCallback failureCallback = (status, code, error, cbObject) =>
{
    Debug.Log(string.Format("Failed | {0}  {1}  {2}", status, code, error));
};

_bc.GamificationService.ReadQuestsWithComplexPercentage(includeMetaData, successCallback, failureCallback);
```

**C++:**

```cpp
bool includeMetaData = false;
_bc->getGamificationService()->readQuestsWithComplexPercentage(includeMetaData, this);
```

**Obj-C:**

```objectivec
bool includeMetaData = false;
BCCompletionBlock successBlock;      // define callback
BCErrorCompletionBlock failureBlock; // define callback

[[_bc gamificationService] readQuestsWithComplexPercentage:includeMetaData
            completionBlock:successBlock
       errorCompletionBlock:failureBlock
                   cbObject:nil];
```

**Java:**

```java
boolean includeMetaData = false;
this; // implements IServerCallback

_bc.getGamificationService().readQuestsWithComplexPercentage(includeMetaData, this);

public void serverCallback(ServiceName serviceName, ServiceOperation serviceOperation, JSONObject jsonData)
{
    System.out.print(String.format("Success | %s", jsonData.toString()));
}
public void serverError(ServiceName serviceName, ServiceOperation serviceOperation, int statusCode, int reasonCode, String jsonError)
{
    System.out.print(String.format("Failed | %d %d %s", statusCode,  reasonCode, jsonError.toString()));
}
```

**JavaScript:**

```javascript
var includeMetaData = false;

_bc.gamification.readQuestsWithComplexPercentage(includeMetaData, result =>
{
    var status = result.status;
    console.log(status + " : " + JSON.stringify(result, null, 2));
});
```

**Dart:**

```dart
var  includeMetaData = false;

ServerResponse result = await _bc.gamificationService.readQuestsWithComplexPercentage(includeMetaData:includeMetaData);

if (result.statusCode == 200) {
    print("Success");
} else {
    print("Failed ${result.error['status_message'] ?? result.error}");
}
```

**Roblox:**

```lua
local includeMetaData = false

local callback = function(success, response)
    if success then
        print("Success")
    else
        print("Failed | " .. tostring(response.status_message))
    end
end

_bc.gamification:readQuestsWithComplexPercentage(callback, includeMetaData)
```

**GDScript:**

```gdscript
N/A
```

**Lua:**

```lua
local includeMetaData = false

local callback = function(success, response)
    if success then
        print("Success")
    else
        print("Failed | " .. tostring(response.status_message))
    end
end

_bc.gamification:readQuestsWithComplexPercentage(callback, includeMetaData)
```

**Cloud Code:**

```cfscript
var includeMetaData = false;
var gamificationProxy = bridge.getGamificationServiceProxy();

var postResult = gamificationProxy.readQuestsWithComplexPercentage(includeMetaData);
if (postResult.status == 200) {
    // Success!
}
```

**Raw:**

```r
{
    "service": "gamification",
    "operation": "READ_QUESTS_WITH_COMPLEX_PERCENTAGE",
    "data": {
        "includeMetaData": false
    }
}
```

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

```json
{
    "data" :
    {
        "quests": []
    },
    "status" : 200
}
```
</details>


---

<!-- source: docs/api/2_capi/gamification/readquestswithstatus.md -->
<!-- url: https://docs.braincloudservers.com/api/capi/gamification/readquestswithstatus -->

# ReadQuestsWithStatus

Method returns quests with a status.

| Service | Operation |
| ------- | --------- |
| gamification | READ_QUESTS_WITH_STATUS |

## Method Parameters
Parameter | Description
--------- | -----------
includeMetaData | Whether to return meta data as well

## Usage

**C#:**

```csharp
bool includeMetaData = false;
SuccessCallback successCallback = (response, cbObject) =>
{
    Debug.Log(string.Format("Success | {0}", response));
};
FailureCallback failureCallback = (status, code, error, cbObject) =>
{
    Debug.Log(string.Format("Failed | {0}  {1}  {2}", status, code, error));
};

_bc.GamificationService.ReadQuestsWithStatus(includeMetaData, successCallback, failureCallback);
```

**C++:**

```cpp
bool includeMetaData = false;
_bc->getGamificationService()->readQuestsWithStatus(includeMetaData, this);
```

**Obj-C:**

```objectivec
bool includeMetaData = false;
BCCompletionBlock successBlock;      // define callback
BCErrorCompletionBlock failureBlock; // define callback

[[_bc gamificationService] readQuestsWithStatus:includeMetaData
            completionBlock:successBlock
       errorCompletionBlock:failureBlock
                   cbObject:nil];
```

**Java:**

```java
boolean includeMetaData = false;
this; // implements IServerCallback

_bc.getGamificationService().readQuestsWithStatus(includeMetaData, this);

public void serverCallback(ServiceName serviceName, ServiceOperation serviceOperation, JSONObject jsonData)
{
    System.out.print(String.format("Success | %s", jsonData.toString()));
}
public void serverError(ServiceName serviceName, ServiceOperation serviceOperation, int statusCode, int reasonCode, String jsonError)
{
    System.out.print(String.format("Failed | %d %d %s", statusCode,  reasonCode, jsonError.toString()));
}
```

**JavaScript:**

```javascript
var includeMetaData = false;

_bc.gamification.readQuestsWithStatus(includeMetaData, result =>
{
    var status = result.status;
    console.log(status + " : " + JSON.stringify(result, null, 2));
});
```

**Dart:**

```dart
var  includeMetaData = false;

ServerResponse result = await _bc.gamificationService.readQuestsWithStatus(includeMetaData:includeMetaData);

if (result.statusCode == 200) {
    print("Success");
} else {
    print("Failed ${result.error['status_message'] ?? result.error}");
}
```

**Roblox:**

```lua
local includeMetaData = false

local callback = function(success, response)
    if success then
        print("Success")
    else
        print("Failed | " .. tostring(response.status_message))
    end
end

_bc.gamification:readQuestsWithStatus(callback, includeMetaData)
```

**GDScript:**

```gdscript
var include_meta_data = false

var result = await _bc.gamification_service.read_quests_with_status(include_meta_data)

if result.status == 200:
	print("Success")
else:
	print("Failed: %s" % result.status_message)
```

**Lua:**

```lua
local includeMetaData = false

local callback = function(success, response)
    if success then
        print("Success")
    else
        print("Failed | " .. tostring(response.status_message))
    end
end

_bc.gamification:readQuestsWithStatus(callback, includeMetaData)
```

**Cloud Code:**

```cfscript
var includeMetaData = false;
var gamificationProxy = bridge.getGamificationServiceProxy();

var postResult = gamificationProxy.readQuestsWithStatus(includeMetaData);
if (postResult.status == 200) {
    // Success!
}
```

**Raw:**

```r
{
    "service": "gamification",
    "operation": "READ_QUESTS_WITH_STATUS",
    "data": {
        "includeMetaData": false
    }
}
```

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

```json
{
    "status" : 200,
    "data" :
    {
        "quests": []
    }
}
```
</details>


---

<!-- source: docs/api/2_capi/gamification/readxplevelsmetadata.md -->
<!-- url: https://docs.braincloudservers.com/api/capi/gamification/readxplevelsmetadata -->

# ReadXpLevelsMetaData

Method returns all defined XP levels and any rewards associated with those XP levels.

| Service | Operation |
| ------- | --------- |
| gamification | READ_XP_LEVELS |

## Usage

**C#:**

```csharp
SuccessCallback successCallback = (response, cbObject) =>
{
    Debug.Log(string.Format("Success | {0}", response));
};
FailureCallback failureCallback = (status, code, error, cbObject) =>
{
    Debug.Log(string.Format("Failed | {0}  {1}  {2}", status, code, error));
};

_bc.GamificationService.ReadXpLevelsMetadata(successCallback, failureCallback);
```

**C++:**

```cpp
_bc->getGamificationService()->readXpLevelsMetadata(this);
```

**Obj-C:**

```objectivec
BCCompletionBlock successBlock;      // define callback
BCErrorCompletionBlock failureBlock; // define callback

[[_bc gamificationService] readXpLevelsMetadata:successBlock
       errorCompletionBlock:failureBlock
                   cbObject:nil];
```

**Java:**

```java
this; // implements IServerCallback

_bc.getGamificationService().readXpLevelsMetadata(this);

public void serverCallback(ServiceName serviceName, ServiceOperation serviceOperation, JSONObject jsonData)
{
    System.out.print(String.format("Success | %s", jsonData.toString()));
}
public void serverError(ServiceName serviceName, ServiceOperation serviceOperation, int statusCode, int reasonCode, String jsonError)
{
    System.out.print(String.format("Failed | %d %d %s", statusCode,  reasonCode, jsonError.toString()));
}
```

**JavaScript:**

```javascript

_bc.gamification.readXpLevelsMetadata(result =>
{
    var status = result.status;
    console.log(status + " : " + JSON.stringify(result, null, 2));
});
```

**Dart:**

```dart

ServerResponse result = await _bc.gamificationService.readXpLevelsMetadata();

if (result.statusCode == 200) {
    print("Success");
} else {
    print("Failed ${result.error['status_message'] ?? result.error}");
}
```

**Roblox:**

```lua

local callback = function(success, response)
    if success then
        print("Success")
    else
        print("Failed | " .. tostring(response.status_message))
    end
end

_bc.gamification:readXPLevelsMetaData(callback)
```

**GDScript:**

```gdscript
var result = await _bc.gamification_service.read_xp_levels_meta_data()

if result.status == 200:
	print("Success")
else:
	print("Failed: %s" % result.status_message)
```

**Lua:**

```lua
local callback = function(success, response)
    if success then
        print("Success")
    else
        print("Failed | " .. tostring(response.status_message))
    end
end

_bc.gamification:readXPLevelsMetaData(callback)
```

**Cloud Code:**

```cfscript
var gamificationProxy = bridge.getGamificationServiceProxy();

var postResult = gamificationProxy.readXpLevelsMetadata();
if (postResult.status == 200) {
    // Success!
}
```

**Raw:**

```r
{
    "service": "gamification",
    "operation": "READ_XP_LEVELS",
    "data": {}
}
```

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

```json
{
    "data": {
        "xp_levels": [
            {
                "level": 1,
                "statusTitle": "Peon",
                "experience": 0,
                "fbAction": ""
            },
            {
                "level": 2,
                "statusTitle": "Small Fry",
                "experience": 1000,
                "fbAction": "",
                "reward": {
                    "currency": {
                        "gold": 500
                    }
                }
            }
        ]
    },
    "status": 200
}
```
</details>


---

<!-- source: docs/api/2_capi/gamification/resetallquestsandmilestones.md -->
<!-- url: https://docs.braincloudservers.com/api/capi/gamification/resetallquestsandmilestones -->

# ResetAllQuestsAndMilestones

Sets all quests and milestones for the current user.

| Service | Operation |
| ------- | --------- |
| gamification | RESET_ALL_QUESTS_AND_MILESTONES |

## 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 gamificationProxy = bridge.getGamificationServiceProxy();

var postResult = gamificationProxy.resetAllQuestsAndMilestones();
if (postResult.status == 200) {
    // Success!
}
```

**Raw:**

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

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

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


---

<!-- source: docs/api/2_capi/gamification/resetmilestones.md -->
<!-- url: https://docs.braincloudservers.com/api/capi/gamification/resetmilestones -->

# ResetMilestones

Resets the specified milestones' statuses.

| Service | Operation |
| ------- | --------- |
| gamification | RESET_MILESTONES |

## Method Parameters

| Parameter  | Description                        |
| ---------- | ---------------------------------- |
| milestones | A list of milestones' IDs to reset |

## 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 milestones = [ "1" ];
var gamificationProxy = bridge.getGamificationServiceProxy();

var postResult = gamificationProxy.resetMilestones(milestones);
if (postResult.status == 200) {
    // Success!
}
```

**Raw:**

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

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

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

</details>


---

<!-- source: docs/api/2_capi/gamification/resetquests.md -->
<!-- url: https://docs.braincloudservers.com/api/capi/gamification/resetquests -->

# ResetQuests

Resets the specified quests' statuses.

| Service | Operation |
| ------- | --------- |
| gamification | RESET_QUESTS |

## Method Parameters
Parameter | Description
--------- | -----------
quests | A list of quests to reset

## 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 quests = [ "QUEST_01" ];
var gamificationProxy = bridge.getGamificationServiceProxy();

var postResult = gamificationProxy.resetQuests(quests);
if (postResult.status == 200) {
    // Success!
}
```

**Raw:**

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

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

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


---

<!-- source: docs/api/2_capi/gamification/sysaddquesttask.md -->
<!-- url: https://docs.braincloudservers.com/api/capi/gamification/sysaddquesttask -->

# SysAddQuestTask

Adds a new task to the specified quest. The id of the newly added task will be returned in the `data.newTask` field of the JSON result.

_Note that tasks are essentially milestones that are embedded within a quest._

An example taskJson object:
```
{
    "title": "Egg Crusher",
    "description": "Crushing Eggs lifetime milestone",
    "category": "mission",
    "extraData": {
        "secretMission": false,
        "actionIndex": 4
    },
    "unlockThresholds": {
        "playerStatistics": {
            "experienceLevel": 2,
            "experiencePoints": 10,
            "statistics": {
                "foodc": 5
            }
        },
        "globalStatistics": {
            "food_unlock": 1
        }
    },
    "thresholds": {
        "playerStatistics": {
            "experienceLevel": 1,
            "experiencePoints": 10,
            "statistics": {
                "returningDay": 7
            }
        }
    },
    "rewards": {
        "experiencePoints": 30,
        "globalStatistics": {
            "globalxp": 30
        },
        "statistics": {
            "a3": 1,
            "secretMissions": 1
        },
        "achievement": "ACH001",
        "currency": {
            "coins": 5
        }
    }
}
```

| Service | Operation |
| ------- | --------- |
| gamification | SYS_ADD_QUEST_TASK |

## Method Parameters
Parameter | Description
--------- | -----------
questId | The quest to add to
version | The current revision of the quest
taskJson | The data defining the task
beforeTaskId | The id of the task to insert before. Pass in null to add to end
 

## 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 questId = "QUEST_CRUSH52";
var version = 1;
var taskJson = {
  "title": "Winner Winner",
  "description": "Get 50 wins",
  "category": "loyalty",
  "extraData": {
    "secretMission": false,
    "actionIndex": 4
  },
  "unlockThresholds": {},
  "thresholds": {
    "playerStatistics": {
      "statistics": {
        "wins": 50
      }
    }
  },
  "rewards": {
    "experiencePoints": 1000
  }
};
var beforeTaskId = null;

var gamificationProxy = bridge.getGamificationServiceProxy();

var postResult = gamificationProxy.sysAddQuestTask(questId, version, taskJson, beforeTaskId);
if (postResult.status == 200) {
    // Success!
}
```

**Raw:**

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

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

```json
{
    "status": 200,
    "data": {
        "quest": {
            "questId": "QUEST_CRUSH52",
            "questType": "unorderedMinimal",
            "questData": "0",
            "title": "Crush 50 Eggs",
            "description": "This is an updated description",
            "category": "mission",
            "extraData": {
                "difficulty": 1
            },
            "rewards": {
                "experiencePoints": 1000
            },
            "createdAt": 1574802052796,
            "updatedAt": 1574820663145,
            "version": 3,
            "tasks": [
                "17"
            ]
        },
        "newTask": "17",
        "tasks": {
            "17": {
                "questId": "QUEST_CRUSH52",
                "title": "Winner Winner",
                "description": "Get 50 wins",
                "category": "loyalty",
                "extraData": {
                    "secretMission": false,
                    "actionIndex": 4
                },
                "rewards": {
                    "experiencePoints": 1000
                },
                "thresholds": {
                    "playerStatistics": {
                        "statistics": {
                            "wins": 50
                        }
                    }
                },
                "createdAt": 1574820663140,
                "updatedAt": 1574820663140,
                "version": 1,
                "taskId": "17"
            }
        }
    }
}
```
</details>


---

<!-- source: docs/api/2_capi/gamification/syscreatemilestone.md -->
<!-- url: https://docs.braincloudservers.com/api/capi/gamification/syscreatemilestone -->

# SysCreateMilestone

Creates the specified milestone. _Note that users will not see the milestone in their data until the next time they log in_.

An example milestoneJson object:
```
{
    "title": "Egg Crusher",
    "description": "Crushing Eggs lifetime milestone",
    "category": "mission",
    "extraData": {
        "secretMission": false,
        "actionIndex": 4
    },
    "unlockThresholds": {
        "playerStatistics": {
            "experienceLevel": 2,
            "experiencePoints": 10,
            "statistics": {
                "foodc": 5
            }
        },
        "globalStatistics": {
            "food_unlock": 1
        }
    },
    "thresholds": {
        "playerStatistics": {
            "experienceLevel": 1,
            "experiencePoints": 10,
            "statistics": {
                "returningDay": 7
            }
        }
    },
    "rewards": {
        "experiencePoints": 30,
        "globalStatistics": {
            "globalxp": 30
        },
        "statistics": {
            "a3": 1,
            "secretMissions": 1
        },
        "achievement": "ACH001",
        "currency": {
            "coins": 5
        }
    }
}
```

| Service | Operation |
| ------- | --------- |
| gamification | SYS_CREATE_MILESTONE |

## Method Parameters
Parameter | Description
--------- | -----------
milestoneJson | A json object describing the milestone to create.

## 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 milestoneJson = {
  "title": "Winner Winner",
  "description": "Get 50 wins",
  "category": "loyalty",
  "extraData": {
    "secretMission": false,
    "actionIndex": 4
  },
  "unlockThresholds": {},
  "thresholds": {
    "playerStatistics": {
      "statistics": {
        "wins": 50
      }
    }
  },
  "rewards": {
    "experiencePoints": 1000
  }
};

var gamificationProxy = bridge.getGamificationServiceProxy();

var postResult = gamificationProxy.sysCreateMilestone(milestoneJson);
if (postResult.status == 200) {
    // Success!
}
```

**Raw:**

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

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

```json
{
    "status": 200,
    "data": {
        "milestoneId": "15",
        "questId": null,
        "title": "Winner Winner",
        "description": "Get 50 wins",
        "category": "loyalty",
        "extraData": {
            "secretMission": false,
            "actionIndex": 4
        },
        "rewards": {
            "experiencePoints": 1000
        },
        "thresholds": {
            "playerStatistics": {
                "statistics": {
                    "wins": 50
                }
            }
        },
        "createdAt": 1574793309304,
        "updatedAt": 1574793309304,
        "version": 1
    }
}
```
</details>


---

<!-- source: docs/api/2_capi/gamification/syscreatequest.md -->
<!-- url: https://docs.braincloudservers.com/api/capi/gamification/syscreatequest -->

# SysCreateQuest

Creates the specified quest. _Note that users will not see the quest in their data until the next time they log in_.

An example questJson object:
```
{
  "questId": "QUEST_CRUSH51",
  "questJson": {
    "title": "Crush 50 Eggs",
    "description": "Crush 50 Eggs quest",
    "category": "mission",
    "questType": "unorderedMinimal",
    "questData": "0",
    "extraData": {
      "difficulty": 1
    },
    "unlockThresholds": {
      "playerStatistics": {
        "experienceLevel": 2,
        "experiencePoints": 10,
        "statistics": {
          "levelC": 5
        }
      },
      "globalStatistics": {
        "level_unlock": 1
      }
    },
    "rewards": {
      "experiencePoints": 30,
      "globalStatistics": {
        "globalxp": 30
      },
      "statistics": {
        "a3": 1,
        "secretMissions": 1
      },
      "achievement": "ACH001",
      "currency": {
        "coins": 5
      }
    }
  }
}
```

| Service | Operation |
| ------- | --------- |
| gamification | SYS_CREATE_QUEST |

## Method Parameters
Parameter | Description
--------- | -----------
questId | The unique id of the quest.
questJson | A json object describing the quest to create.

## 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 questId = "QUEST_CRUSH50";
var questJson = {
  "title": "Crush 50 Eggs",
  "description": "Crush 50 Eggs quest",
  "category": "mission",
  "questType": "unorderedMinimal",
  "questData": "0",
  "extraData": {
    "difficulty": 1
  },
  "unlockThresholds": {},
  "rewards": {
    "experiencePoints": 1000
  }
};

var gamificationProxy = bridge.getGamificationServiceProxy();

var postResult = gamificationProxy.sysCreateQuest(questId, questJson);
if (postResult.status == 200) {
    // Success!
}
```

**Raw:**

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

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

```json
{
    "status": 200,
    "data": {
        "questId": "QUEST_CRUSH52",
        "questType": "unorderedMinimal",
        "questData": "0",
        "title": "Crush 50 Eggs",
        "description": "Crush 50 Eggs quest",
        "category": "mission",
        "extraData": {
            "difficulty": 1
        },
        "rewards": {
            "experiencePoints": 1000
        },
        "createdAt": 1574801519979,
        "updatedAt": 1574801519979,
        "version": 1,
        "tasks": []
    }
}
```
</details>


---

<!-- source: docs/api/2_capi/gamification/sysdeletemilestone.md -->
<!-- url: https://docs.braincloudservers.com/api/capi/gamification/sysdeletemilestone -->

# SysDeleteMilestone

Deletes the specified milestone.

| Service | Operation |
| ------- | --------- |
| gamification | SYS_DELETE_MILESTONE |

## Method Parameters
Parameter | Description
--------- | -----------
milestoneId | The id of the milestone to delete
version | The current revision of the milestone. Use -1 to bypass the version-check.

## 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 milestoneId = "15";

var gamificationProxy = bridge.getGamificationServiceProxy();

// Delete the milestone.
var postResult = gamificationProxy.sysDeleteMilestone(milestoneId, -1);
if (postResult.status == 200) {
    // Success!
}
```

**Raw:**

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

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

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


---

<!-- source: docs/api/2_capi/gamification/sysdeletequest.md -->
<!-- url: https://docs.braincloudservers.com/api/capi/gamification/sysdeletequest -->

# SysDeleteQuest

Deletes the specified quest.

| Service | Operation |
| ------- | --------- |
| gamification | SYS_DELETE_QUEST |

## Method Parameters
Parameter | Description
--------- | -----------
questId | The id of the quest to delete
version | The current revision of the quest. Use -1 to bypass the version-check.

## 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 questId = "QUEST_CRUSH52";

var gamificationProxy = bridge.getGamificationServiceProxy();

// Delete the quest.
var postResult = gamificationProxy.sysDeleteQuest(questId, -1);
if (postResult.status == 200) {
    // Success!
}
```

**Raw:**

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

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

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


---

<!-- source: docs/api/2_capi/gamification/sysdeletequesttask.md -->
<!-- url: https://docs.braincloudservers.com/api/capi/gamification/sysdeletequesttask -->

# SysDeleteQuestTask

Deletes an embedded task in the specified quest. The id of the deleted task will be returned in the `data.deletedTask` field of the JSON result.

| Service | Operation |
| ------- | --------- |
| gamification | SYS_DELETE_QUEST_TASK |

## Method Parameters
Parameter | Description
--------- | -----------
questId | The quest the task belongs to
version | The current revision of the parent _quest_. (Note - _not_ the version of the embedded _task_)
taskId | The id of the task to delete

## 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 questId = "QUEST_CRUSH52";
var taskId = "18";

var gamificationProxy = bridge.getGamificationServiceProxy();

var postResult = gamificationProxy.sysDeleteQuestTask(questId, -1, taskId);
if (postResult.status == 200) {
    // Success!
}
```

**Raw:**

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

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

```json
{
    "status": 200,
    "data": {
        "quest": {
            "questId": "QUEST_CRUSH52",
            "questType": "unorderedMinimal",
            "questData": "0",
            "title": "Crush 50 Eggs",
            "description": "This is an updated description",
            "category": "mission",
            "extraData": {
                "difficulty": 1
            },
            "rewards": {
                "experiencePoints": 1000
            },
            "createdAt": 1574802052796,
            "updatedAt": 1574863558897,
            "version": 4,
            "tasks": [
                "17"
            ]
        },
        "deletedTask": "18",
        "tasks": {
            "17": {
                "title": "Winner Winner",
                "description": "An updated task description",
                "category": "loyalty",
                "extraData": {
                    "secretMission": false,
                    "actionIndex": 4
                },
                "rewards": {
                    "experiencePoints": 1000
                },
                "thresholds": {
                    "playerStatistics": {
                        "statistics": {
                            "wins": 50
                        }
                    }
                },
                "createdAt": 1574820663140,
                "updatedAt": 1574863558901,
                "version": 2,
                "taskId": "17"
            }
        }
    }
}
```
</details>


---

<!-- source: docs/api/2_capi/gamification/sysgetmilestonepage.md -->
<!-- url: https://docs.braincloudservers.com/api/capi/gamification/sysgetmilestonepage -->

# SysGetMilestonePage

Retrieves the first page of milestones.

_Note that this call does not return milestones (i.e. tasks) that are embedded within Quests. Use the Quests API for those._

After retrieving a page of milestones with this method use [sysGetMilestonePageOffset](/api/capi/gamification/sysgetmilestonepageoffset) to retrieve previous or next pages.

See the [Generic Paged Queries](/api/appendix/genericpagedqueries) documentation for creating the context object.

Supported `searchCriteria` fields include:

-   `milestoneId`
-   `title`
-   `description`
-   `category`
-   and `extraData` fields (must be prefixed by `extraData`) - i.e. `extraData.actionIndex`

| Service | Operation |
| ------- | --------- |
| gamification | SYS_GET_MILESTONE_PAGE |

## Method Parameters

| Parameter | Description                            |
| --------- | -------------------------------------- |
| context   | The json context for the page request. |

## 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 context = {
    "pagination": {
        "rowsPerPage": 2,
        "pageNumber": 1
    },
    "searchCriteria": {},
    "sortCriteria": {
        "milestoneId": 1
    }
};

var gameficationProxy = bridge.getGamificationServiceProxy();
var milestonePage = gameficationProxy.sysGetMilestonePage(context);
```

**Raw:**

```r
// N/A
```

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

```json
{
    "data": {
        "context": "eyJzZWFyY2hDcml0ZXJpYSI6ey...",
        "results": {
            "count": 3,
            "page": 1,
            "items": [
                {
                    "milestoneId": "1",
                    "questId": null,
                    "title": "Egg Crusher",
                    "description": "Crushing Eggs lifetime milestone",
                    "category": "mission",
                    "extraData": {
                        "secretMission": false,
                        "actionIndex": 4
                    },
                    "rewards": {
                        "experiencePoints": 30,
                        "achievement": "ACH001",
                        "currency": {
                            "coins": 5
                        },
                        "globalStatistics": {
                            "globalxp": 30
                        },
                        "statistics": {
                            "a3": 1,
                            "secretMissions": 1
                        }
                    },
                    "thresholds": {
                        "playerStatistics": {
                            "experienceLevel": 1,
                            "experiencePoints": 10,
                            "statistics": {
                                "returningDay": 7
                            }
                        }
                    },
                    "unlockThresholds": {
                        "playerStatistics": {
                            "experienceLevel": 2,
                            "experiencePoints": 10,
                            "statistics": {
                                "foodc": 5
                            }
                        },
                        "globalStatistics": {
                            "food_unlock": 1
                        }
                    },
                    "createdAt": 1574792720983,
                    "updatedAt": 1574792720983,
                    "version": 1
                },
                {
                    "milestoneId": "2",
                    "questId": null,
                    "title": "Another milestone",
                    "description": "Not yet fully defined",
                    "category": "mission",
                    "extraData": null,
                    "createdAt": 1574111511152,
                    "updatedAt": 1574111511152,
                    "version": 1
                }
            ],
            "moreAfter": true,
            "moreBefore": false
        }
    },
    "status": 200
}
```

</details>


---

<!-- source: docs/api/2_capi/gamification/sysgetmilestonepageoffset.md -->
<!-- url: https://docs.braincloudservers.com/api/capi/gamification/sysgetmilestonepageoffset -->

# SysGetMilestonePageOffset

Retrieves the next/prev page of milestones.

_Note that this call does not return milestones (i.e. tasks) that are embedded within Quests. Use the Quests API for those._

See the [Generic Paged Queries](/api/appendix/genericpagedqueries) documentation for creating the context object.

| Service | Operation |
| ------- | --------- |
| gamification | SYS_GET_MILESTONE_PAGE_OFFSET |

## Method Parameters

| Parameter      | Description                                                                                                                         |
| -------------- | ----------------------------------------------------------------------------------------------------------------------------------- |
| encodedContext | The json context from the previous page request.                                                                                    |
| pageOffset     | The positive or negative page offset to fetch. Uses the last page retrieved using the context string to determine a starting point. |

## 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 context = {
    "pagination": {
        "rowsPerPage": 2,
        "pageNumber": 1
    },
    "searchCriteria": {},
    "sortCriteria": {
        "milestoneId": 1
    }
};

var gameficationProxy = bridge.getGamificationServiceProxy();
var milestonePage = gameficationProxy.sysGetMilestonePage(context);
var encodedContext = "";

if ( milestonePage.status == 200 ) {
  if ( milestonePage.data.results.moreAfter == true ) {

    //...

    // Get the next page...
    encodedContext = milestonePage.data.context;
    milestonePage = gamificationProxy.sysGetMilestonePageOffset(encodedContext, 1);
    if ( milestonePage.status == 200 ) {

      // Success!

    }
  }

}
```

**Raw:**

```r
// N/A
```

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

```json
{
    "data": {
        "context": "eyJzZWFyY2hDcml0ZXa...",
        "results": {
            "count": 3,
            "page": 2,
            "items": [
                {
                    "milestoneId": "3",
                    "questId": null,
                    "title": "Egg Crusher",
                    "description": "Crushing Eggs lifetime milestone",
                    "category": "mission",
                    "extraData": {
                        "batmanIs": "awesome2"
                    },
                    "rewards": {
                        "experiencePoints": 30,
                        "achievement": "ACH001",
                        "currency": {
                            "coins": 5
                        },
                        "globalStatistics": {
                            "globalxp": 30
                        },
                        "statistics": {
                            "a3": 1,
                            "secretMissions": 1
                        }
                    },
                    "thresholds": {
                        "playerStatistics": {
                            "experienceLevel": 1,
                            "experiencePoints": 10,
                            "statistics": {
                                "returningDay": 7
                            }
                        }
                    },
                    "unlockThresholds": {
                        "playerStatistics": {
                            "experienceLevel": 2,
                            "experiencePoints": 10,
                            "statistics": {
                                "foodc": 5
                            }
                        },
                        "globalStatistics": {
                            "food_unlock": 1
                        }
                    },
                    "createdAt": 1574691758570,
                    "updatedAt": 1574691922583,
                    "version": 4
                }
            ],
            "moreAfter": false,
            "moreBefore": true
        }
    },
    "status": 200
}
```

</details>


---

<!-- source: docs/api/2_capi/gamification/sysgetquestpage.md -->
<!-- url: https://docs.braincloudservers.com/api/capi/gamification/sysgetquestpage -->

# SysGetQuestPage

Retrieves the first page of quests.

After retrieving a page of quests with this method use [sysGetQuestPageOffset](/api/capi/gamification/sysgetquestpageoffset) to retrieve previous or next pages.

See the [Generic Paged Queries](/api/appendix/genericpagedqueries) documentation for creating the context object.

Supported `searchCriteria` fields include:

-   `questId`
-   `title`
-   `description`
-   `category`
-   and `extraData` fields (must be prefixed by `extraData`) - i.e. `extraData.actionIndex`

| Service | Operation |
| ------- | --------- |
| gamification | SYS_GET_QUEST_PAGE |

## Method Parameters

| Parameter | Description                            |
| --------- | -------------------------------------- |
| context   | The json context for the page request. |

## 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 context = {
    "pagination": {
        "rowsPerPage": 2,
        "pageNumber": 1
    },
    "searchCriteria": {},
    "sortCriteria": {
        "questId": 1
    }
};

var gameficationProxy = bridge.getGamificationServiceProxy();
var questPage = gameficationProxy.sysGetQuestPage(context);
```

**Raw:**

```r
// N/A
```

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

```json
{
    "data": {
        "context": "eyJzZWFyY2hDcml0ZXJpYSI6ey...",
        "results": {
            "count": 5,
            "page": 1,
            "items": [
                {
                    "questId": "QUEST_CRUSH50",
                    "questType": "unorderedMinimal",
                    "questData": "0",
                    "title": "Crush 50 Eggs",
                    "description": "Crush 50 Eggs quest",
                    "category": "mission",
                    "extraData": {
                        "difficulty": 1
                    },
                    "rewards": {
                        "experiencePoints": 30,
                        "achievement": "ACH001",
                        "currency": {
                            "coins": 5
                        },
                        "globalStatistics": {
                            "globalxp": 30
                        },
                        "statistics": {
                            "a3": 1,
                            "secretMissions": 1
                        }
                    },
                    "unlockThresholds": {
                        "playerStatistics": {
                            "experienceLevel": 2,
                            "experiencePoints": 10,
                            "statistics": {
                                "levelC": 5
                            }
                        },
                        "globalStatistics": {
                            "level_unlock": 1
                        }
                    },
                    "createdAt": 1574692241409,
                    "updatedAt": 1574692313569,
                    "version": 2,
                    "tasks": ["11"]
                },
                {
                    "questId": "QUEST_CRUSH51",
                    "questType": "unorderedMinimal",
                    "questData": "0",
                    "title": "Crush 50 Eggs",
                    "description": "Crush 50 Eggs quest",
                    "category": "mission",
                    "extraData": {
                        "difficulty": 1
                    },
                    "rewards": {
                        "experiencePoints": 30,
                        "achievement": "ACH001",
                        "currency": {
                            "coins": 5
                        },
                        "globalStatistics": {
                            "globalxp": 30
                        },
                        "statistics": {
                            "a3": 1,
                            "secretMissions": 1
                        }
                    },
                    "unlockThresholds": {
                        "playerStatistics": {
                            "experienceLevel": 2,
                            "experiencePoints": 10,
                            "statistics": {
                                "levelC": 5
                            }
                        },
                        "globalStatistics": {
                            "level_unlock": 1
                        }
                    },
                    "createdAt": 1574801362234,
                    "updatedAt": 1574801362234,
                    "version": 1,
                    "tasks": []
                }
            ],
            "moreAfter": true,
            "moreBefore": false
        }
    },
    "status": 200
}
```

</details>


---

<!-- source: docs/api/2_capi/gamification/sysgetquestpageoffset.md -->
<!-- url: https://docs.braincloudservers.com/api/capi/gamification/sysgetquestpageoffset -->

# SysGetQuestPageOffset

Retrieves the next/prev page of quests.

See the [Generic Paged Queries](/api/appendix/genericpagedqueries) documentation for creating the context object.

| Service | Operation |
| ------- | --------- |
| gamification | SYS_GET_QUEST_PAGE_OFFSET |

## Method Parameters

| Parameter      | Description                                                                                                                         |
| -------------- | ----------------------------------------------------------------------------------------------------------------------------------- |
| encodedContext | The json context from the previous page request.                                                                                    |
| pageOffset     | The positive or negative page offset to fetch. Uses the last page retrieved using the context string to determine a starting point. |

## 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 context = {
    "pagination": {
        "rowsPerPage": 2,
        "pageNumber": 1
    },
    "searchCriteria": {},
    "sortCriteria": {
        "questId": 1
    }
};

var gameficationProxy = bridge.getGamificationServiceProxy();
var questPage = gameficationProxy.sysGetQuestPage(context);
var encodedContext = "";

if ( questPage.status == 200 ) {
  if ( questPage.data.results.moreAfter == true ) {

    //...

    // Get the next page...
    encodedContext = questPage.data.context;
    questPage = gamificationProxy.sysGetQuestPageOffset(encodedContext, 1);
    if ( questPage.status == 200 ) {

      // Success!

    }
  }

}
```

**Raw:**

```r
// N/A
```

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

```json
{
    "data": {
        "context": "eyJzZWFyY2hDcml0ZXJpY...",
        "results": {
            "count": 5,
            "page": 2,
            "items": [
                {
                    "questId": "QUEST_CRUSH52",
                    "questType": "unorderedMinimal",
                    "questData": "0",
                    "title": "Crush 50 Eggs",
                    "description": "This is an updated description",
                    "category": "mission",
                    "extraData": {
                        "difficulty": 1
                    },
                    "rewards": {
                        "experiencePoints": 1000
                    },
                    "createdAt": 1574802052796,
                    "updatedAt": 1574809351418,
                    "version": 2,
                    "tasks": []
                },
                {
                    "questId": "quest001",
                    "questType": "unorderedComplete",
                    "questData": null,
                    "title": "quest001",
                    "description": "",
                    "category": "misc",
                    "extraData": null,
                    "createdAt": 1574266600502,
                    "updatedAt": 1574266600502,
                    "version": 1,
                    "tasks": []
                }
            ],
            "moreAfter": true,
            "moreBefore": true
        }
    },
    "status": 200
}
```

</details>


---

<!-- source: docs/api/2_capi/gamification/sysreadmilestone.md -->
<!-- url: https://docs.braincloudservers.com/api/capi/gamification/sysreadmilestone -->

# SysReadMilestone

Retrieves the meta-data for the specified milestone.

| Service | Operation |
| ------- | --------- |
| gamification | SYS_READ_MILESTONE |

## Method Parameters
Parameter | Description
--------- | -----------
milestoneId | The id of the milestone 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 milestoneId = "15";

var gamificationProxy = bridge.getGamificationServiceProxy();

var postResult = gamificationProxy.sysReadMilestone(milestoneId);
if (postResult.status == 200) {
    // Success!
}
```

**Raw:**

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

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

```json
{
    "status": 200,
    "data": {
        "milestoneId": "15",
        "questId": null,
        "title": "Winner Winner",
        "description": "Get 50 wins",
        "category": "loyalty",
        "extraData": {
            "secretMission": false,
            "actionIndex": 4
        },
        "rewards": {
            "experiencePoints": 1000
        },
        "thresholds": {
            "playerStatistics": {
                "statistics": {
                    "wins": 50
                }
            }
        },
        "createdAt": 1574793309304,
        "updatedAt": 1574793309304,
        "version": 1
    }
}
```
</details>


---

<!-- source: docs/api/2_capi/gamification/sysreadquest.md -->
<!-- url: https://docs.braincloudservers.com/api/capi/gamification/sysreadquest -->

# SysReadQuest

Retrieves the meta-data for the specified quest.

| Service | Operation |
| ------- | --------- |
| gamification | SYS_READ_QUEST |

## Method Parameters
Parameter | Description
--------- | -----------
questId | The id of the quest 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 questId = "QUEST_CRUSH52";

var gamificationProxy = bridge.getGamificationServiceProxy();

var postResult = gamificationProxy.sysReadQuest(questId);
if (postResult.status == 200) {
    // Success!
}
```

**Raw:**

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

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

```json
{
    "status": 200,
    "data": {
        "quest": {
            "questId": "QUEST_CRUSH52",
            "questType": "unorderedMinimal",
            "questData": "0",
            "title": "Crush 50 Eggs",
            "description": "Crush 50 Eggs quest",
            "category": "mission",
            "extraData": {
                "difficulty": 1
            },
            "rewards": {
                "experiencePoints": 1000
            },
            "createdAt": 1574801519979,
            "updatedAt": 1574801519979,
            "version": 1,
            "tasks": []
        },
        "tasks": {}
    }
}
```
</details>


---

<!-- source: docs/api/2_capi/gamification/sysreorderquesttasks.md -->
<!-- url: https://docs.braincloudservers.com/api/capi/gamification/sysreorderquesttasks -->

# SysReorderQuestTasks

Re-orders the tasks in the quest. If any tasks are missing from the new order, they will be deleted. The ids of any deleted tasks will be returned in the `data.deletedTasks` field of the JSON result.

| Service | Operation |
| ------- | --------- |
| gamification | SYS_REORDER_QUEST_TASKS |

## Method Parameters
Parameter | Description
--------- | -----------
questId | The quest to reorder
version | The current revision of the _quest_.
newTaskArray | An ordered array of task ids. Note - any tasks not present in the array will be deleted from the quest.

## 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 questId = "QUEST_CRUSH52";
var newTaskOrder = ["19","17];

var gamificationProxy = bridge.getGamificationServiceProxy();

var postResult = gamificationProxy.sysReorderQuestTasks(questId, -1, newTaskOrder);
if (postResult.status == 200) {
    // Success!
}
```

**Raw:**

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

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

```json
{
    "status": 200,
    "data": {
        "quest": {
            "questId": "QUEST_CRUSH52",
            "questType": "unorderedMinimal",
            "questData": "0",
            "title": "Crush 50 Eggs",
            "description": "This is an updated description",
            "category": "mission",
            "extraData": {
                "difficulty": 1
            },
            "rewards": {
                "experiencePoints": 1000
            },
            "createdAt": 1574802052796,
            "updatedAt": 1574866260391,
            "version": 8,
            "tasks": [
                "19",
                "17"
            ]
        },
        "deletedTasks": [],
        "tasks": {
            "17": {
                "questId": "QUEST_CRUSH52",
                "title": "Winner Winner",
                "description": "An updated task description",
                "category": "loyalty",
                "extraData": {
                    "secretMission": false,
                    "actionIndex": 4
                },
                "rewards": {
                    "experiencePoints": 1000
                },
                "thresholds": {
                    "playerStatistics": {
                        "statistics": {
                            "wins": 50
                        }
                    }
                },
                "createdAt": 1574820663140,
                "updatedAt": 1574863558901,
                "version": 2,
                "taskId": "17"
            },
            "19": {
                "questId": "QUEST_CRUSH52",
                "title": "Another task",
                "description": "Crushing Eggs task",
                "category": "mission",
                "extraData": {},
                "rewards": {
                    "experiencePoints": 30
                },
                "thresholds": {
                    "playerStatistics": {
                        "statistics": {
                            "returningDay": 7
                        }
                    }
                },
                "createdAt": 1574866217734,
                "updatedAt": 1574866217734,
                "version": 1,
                "taskId": "19"
            }
        }
    }
}
```
</details>


---

<!-- source: docs/api/2_capi/gamification/sysupdatemilestone.md -->
<!-- url: https://docs.braincloudservers.com/api/capi/gamification/sysupdatemilestone -->

# SysUpdateMilestone

Updates the specified milestone. Note that only the fields present in the JSON object will be updated. (i.e. to leave ACL as is, don't include it in the milestoneJson field).

| Service | Operation |
| ------- | --------- |
| gamification | SYS_UPDATE_MILESTONE |

## Method Parameters
Parameter | Description
--------- | -----------
milestoneId | The id of the milestone to update
version | The current revision of the milestone
milestoneJson | A json object describing the updated milestone data. Only the fields present will be updated.

## 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 milestoneId = "15";

var gamificationProxy = bridge.getGamificationServiceProxy();

var readResult = gamificationProxy.sysReadMilestone(milestoneId);
if (readResult.status == 200) {

  var version = readResult.data.version;

  // Only including the fields to update
  var milestoneJson = {
    "description": "This is an updated description"
  }

  var updateResult = gamificationProxy.sysUpdateMilestone(milestoneId, version, milestoneJson);
  if (updateResult.status == 200) {
    // Success!

  }
}
```

**Raw:**

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

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

```json
{
    "status": 200,
    "data": {
        "milestoneId": "15",
        "questId": null,
        "title": "Winner Winner",
        "description": "This is an updated description",
        "category": "loyalty",
        "extraData": {
            "secretMission": false,
            "actionIndex": 4
        },
        "rewards": {
            "experiencePoints": 1000
        },
        "thresholds": {
            "playerStatistics": {
                "statistics": {
                    "wins": 50
                }
            }
        },
        "createdAt": 1574793309304,
        "updatedAt": 1574793309304,
        "version": 2
    }
}
```
</details>


---

<!-- source: docs/api/2_capi/gamification/sysupdatequest.md -->
<!-- url: https://docs.braincloudservers.com/api/capi/gamification/sysupdatequest -->

# SysUpdateQuest

Updates the specified quest. Note that only the fields present in the JSON object will be updated. (i.e. to leave ACL as is, don't include it in the `questJson` field).

| Service | Operation |
| ------- | --------- |
| gamification | SYS_UPDATE_QUEST |

## Method Parameters
Parameter | Description
--------- | -----------
questId | The id of the quest to update
version | The current revision of the quest
questJson | A json object describing the updated quest data. Only the fields present will be updated.

## 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 questId = "QUEST_CRUSH52;

var gamificationProxy = bridge.getGamificationServiceProxy();

var readResult = gamificationProxy.sysReadQuest(questId);
if (readResult.status == 200) {

  var version = readResult.data.version;

  // Only including the fields to update
  var questJson = {
    "description": "This is an updated description"
  }

  var updateResult = gamificationProxy.sysUpdateQuest(milestoneId, version, questJson);
  if (updateResult.status == 200) {
    // Success!

  }
}
```

**Raw:**

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

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

```json
{
    "data": {
        "quest": {
            "questId": "test",
            "questType": "unorderedMinimal",
            "questData": "0",
            "title": "Crush 50 Eggs",
            "description": "Crush 50 Eggs of same colour",
            "category": "mission",
            "extraData": {
                "secretMission": false,
                "difficulty": 1
            },
            "rewards": {
                "experiencePoints": 30,
                "achievement": "ACH001",
                "currency": {
                    "gumdrops": 8
                },
                "globalStatistics": {
                    "globalxp": 40
                },
                "statistics": {
                    "a3": 1,
                    "secretMissions": 1
                }
            },
            "unlockThresholds": {
                "playerStatistics": {
                    "experienceLevel": 2,
                    "experiencePoints": 15
                }
            },
            "createdAt": 1647609902645,
            "updatedAt": 1770163638116,
            "version": 4,
            "tasks": [
                "13"
            ]
        },
        "tasks": {
            "13": {
                "createdAt": 1647868845428,
                "thresholds": {
                    "playerStatistics": {
                        "statistics": {
                            "a3": 50
                        }
                    }
                },
                "extraData": {
                    "secretMission": false,
                    "actionIndex": 4
                },
                "description": "Get 50 wins",
                "title": "Winner Winner",
                "category": "loyalty",
                "version": 1,
                "rewards": {
                    "experiencePoints": 1000
                },
                "taskId": "13",
                "updatedAt": 1647868845428
            }
        }
    },
    "status": 200
}
```
</details>


---

<!-- source: docs/api/2_capi/gamification/sysupdatequesttask.md -->
<!-- url: https://docs.braincloudservers.com/api/capi/gamification/sysupdatequesttask -->

# SysUpdateQuestTask

Updates an embedded task in the specified quest. The id of the newly updated task will be returned in the `data.updatedTask` field of the JSON result.

| Service | Operation |
| ------- | --------- |
| gamification | SYS_UPDATE_QUEST_TASK |

## Method Parameters
Parameter | Description
--------- | -----------
questId | The quest the task belongs to
version | The current revision of the parent _quest_. (Note - _not_ the version of the embedded _task_)
taskId | The id of the task to update
taskJson | A json object describing the updated task data. Only the fields present will be updated.

## 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 questId = "QUEST_CRUSH52";
var taskId = "17";
var taskJson = {
  "description": "Updated task description"
};

var gamificationProxy = bridge.getGamificationServiceProxy();

var postResult = gamificationProxy.sysUpdateQuestTask(questId, -1, taskId, taskJson);
if (postResult.status == 200) {
    // Success!
}
```

**Raw:**

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

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

```json
{
    "status": 200,
    "data": {
        "quest": {
            "questId": "QUEST_CRUSH52",
            "questType": "unorderedMinimal",
            "questData": "0",
            "title": "Crush 50 Eggs",
            "description": "This is an updated description",
            "category": "mission",
            "extraData": {
                "difficulty": 1
            },
            "rewards": {
                "experiencePoints": 1000
            },
            "createdAt": 1574802052796,
            "updatedAt": 1574863558897,
            "version": 4,
            "tasks": [
                "17"
            ]
        },
        "updatedTask": "17",
        "tasks": {
            "17": {
                "title": "Winner Winner",
                "description": "An updated task description",
                "category": "loyalty",
                "extraData": {
                    "secretMission": false,
                    "actionIndex": 4
                },
                "rewards": {
                    "experiencePoints": 1000
                },
                "thresholds": {
                    "playerStatistics": {
                        "statistics": {
                            "wins": 50
                        }
                    }
                },
                "createdAt": 1574820663140,
                "updatedAt": 1574863558901,
                "version": 2,
                "taskId": "17"
            }
        }
    }
}
```
</details>


---

<!-- source: docs/api/2_capi/gamification/updaterewards.md -->
<!-- url: https://docs.braincloudservers.com/api/capi/gamification/updaterewards -->

# UpdateRewards

Updates player rewards.

| Service | Operation |
| ------- | --------- |
| gamification | UPDATE_REWARDS |

## Method Parameters
Parameter | Description
--------- | -----------
includeMetaData | Whether to return meta data as well

## 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 includeMetaData = false;
var gamificationProxy = bridge.getGamificationServiceProxy();

var postResult = gamificationProxy.updateRewards(includeMetaData);
if (postResult.status == 200) {
    // Success!
}
```

**Raw:**

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

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

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


---

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

# Gamification

brainCloud's Gamification features provide server-side support common metagame elements, including:

- Experience Points (XP) and Levels
- Achievements
- Milestones
- Quests
- Stats Events

These features build upon the Statistics APIs and a concept of Player Rewards.

### API Summary

### Milestone Management

_The Milestone Management APIs are available from cloud-code only._

* [SysCreateMilestone](/api/capi/gamification/syscreatemilestone)
* [SysDeleteMilestone](/api/capi/gamification/sysdeletemilestone)
* [SysReadMilestone](/api/capi/gamification/sysreadmilestone)
* [SysUpdateMilestone](/api/capi/gamification/sysupdatemilestone)
* [SysGetMilestonePage](/api/capi/gamification/sysgetmilestonepage)
* [SysGetMilestonePageOffset](/api/capi/gamification/sysgetmilestonepageoffset)

### Quest Management

_The Quest Management APIs are available from cloud-code only._

* [SysCreateQuest](/api/capi/gamification/syscreatequest)
* [SysDeleteQuest](/api/capi/gamification/sysdeletequest)
* [SysReadQuest](/api/capi/gamification/sysreadquest)
* [SysUpdateQuest](/api/capi/gamification/sysupdatequest)
* [SysAddQuestTask](/api/capi/gamification/sysaddquesttask)
* [SysDeleteQuestTask](/api/capi/gamification/sysdeletequesttask)
* [SysReorderQuestTasks](/api/capi/gamification/sysreorderquesttasks)
* [SysUpdateQuestTask](/api/capi/gamification/sysupdatequesttask)
* [SysGetQuestPage](/api/capi/gamification/sysgetquestpage)
* [SysGetQuestPageOffset](/api/capi/gamification/sysgetquestpageoffset)

> **Tip:** All the client APIs that the names beigin with <strong>"Sys"</strong> <em>are</em> also available to S2S.
> For the usages of the S2S customEntity APIs (if they are not listed at this section),
> refer to brainCloud client [gamification](/api/capi/gamification) APIs.


---

<!-- source: docs/api/4_s2s/gamification/sysaddquesttask.md -->
<!-- url: https://docs.braincloudservers.com/api/s2s/gamification/sysaddquesttask -->

# SysAddQuestTask

Adds a new task to the specified quest. The id of the newly added task will be returned in the `data.newTask` field of the JSON result.

_Note that tasks are essentially milestones that are embedded within a quest._

An example taskJson object:

```
{
    "title": "Egg Crusher",
    "description": "Crushing Eggs lifetime milestone",
    "category": "mission",
    "extraData": {
        "secretMission": false,
        "actionIndex": 4
    },
    "unlockThresholds": {
        "playerStatistics": {
            "experienceLevel": 2,
            "experiencePoints": 10,
            "statistics": {
                "foodc": 5
            }
        },
        "globalStatistics": {
            "food_unlock": 1
        }
    },
    "thresholds": {
        "playerStatistics": {
            "experienceLevel": 1,
            "experiencePoints": 10,
            "statistics": {
                "returningDay": 7
            }
        }
    },
    "rewards": {
        "experiencePoints": 30,
        "globalStatistics": {
            "globalxp": 30
        },
        "statistics": {
            "a3": 1,
            "secretMissions": 1
        },
        "achievement": "ACH001",
        "currency": {
            "coins": 5
        }
    }
}
```

| Service | Operation |
| ------- | --------- |
| gamification | SYS_ADD_QUEST_TASK |

## Method Parameters

| Parameter    | Description                                                     |
| ------------ | --------------------------------------------------------------- |
| questId      | The quest to add to                                             |
| version      | The current revision of the quest                               |
| taskJson     | The data defining the task                                      |
| beforeTaskId | The id of the task to insert before. Pass in null to add to end |

## 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 questId = "QUEST_CRUSH52";
var version = 1;
var taskJson = {
  "title": "Winner Winner",
  "description": "Get 50 wins",
  "category": "loyalty",
  "extraData": {
    "secretMission": false,
    "actionIndex": 4
  },
  "unlockThresholds": {},
  "thresholds": {
    "playerStatistics": {
      "statistics": {
        "wins": 50
      }
    }
  },
  "rewards": {
    "experiencePoints": 1000
  }
};
var beforeTaskId = null;

var gamificationProxy = bridge.getGamificationServiceProxy();

var postResult = gamificationProxy.sysAddQuestTask(questId, version, taskJson, beforeTaskId);
if (postResult.status == 200) {
    // Success!
}
```

**Raw:**

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

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

```json
{
    "data": {
        "quest": {
            "questId": "QUEST_CRUSH52",
            "questType": "unorderedMinimal",
            "questData": "0",
            "title": "Crush 50 Eggs",
            "description": "This is an updated description",
            "category": "mission",
            "extraData": {
                "difficulty": 1
            },
            "rewards": {
                "experiencePoints": 1000
            },
            "createdAt": 1574802052796,
            "updatedAt": 1574820663145,
            "version": 3,
            "tasks": ["17"]
        },
        "newTask": "17",
        "tasks": {
            "17": {
                "questId": "QUEST_CRUSH52",
                "title": "Winner Winner",
                "description": "Get 50 wins",
                "category": "loyalty",
                "extraData": {
                    "secretMission": false,
                    "actionIndex": 4
                },
                "rewards": {
                    "experiencePoints": 1000
                },
                "thresholds": {
                    "playerStatistics": {
                        "statistics": {
                            "wins": 50
                        }
                    }
                },
                "createdAt": 1574820663140,
                "updatedAt": 1574820663140,
                "version": 1,
                "taskId": "17"
            }
        }
    },
    "status": 200
}
```

</details>
