Documentation

UpdatePlayerStatisticDefinition

Updates a player statistic configuration for the title, optionally allowing the developer to specify a reset interval.

Request Details

Statistics are numeric values, with each statistic in the title also generating a leaderboard. The ResetInterval enables automatically resetting leaderboards on a specified interval. Upon reset, the statistic updates to a new version with no values (effectively removing all players from the leaderboard). The previous version's statistic values are also archived for retrieval, if needed (see GetPlayerStatisticVersions). Statistics not created via a call to CreatePlayerStatisticDefinition by default have a VersionChangeInterval of Never, meaning they do not reset on a schedule, but they can be set to do so via a call to UpdatePlayerStatisticDefinition. Once a statistic has been reset (sometimes referred to as versioned or incremented), the now-previous version can still be written to for up a short, pre-defined period (currently 10 seconds), to prevent issues with levels completing around the time of the reset. Also, once reset, the historical statistics for players in the title may be retrieved using the URL specified in the version information (GetPlayerStatisticVersions). The AggregationMethod determines what action is taken when a new statistic value is submitted - always update with the new value (Last), use the highest of the old and new values (Max), use the smallest (Min), or add them together (Sum).

UpdatePlayerStatisticDefinitionRequest
Request Properties
AggregationMethod StatisticAggregationMethod

the aggregation method to use in updating the statistic (defaults to last)

StatisticName (required) String

unique name of the statistic

VersionChangeInterval StatisticResetIntervalOption

interval at which the values of the statistic for all players are reset (changes are effective at the next occurance of the new interval boundary)

POST https://{{TitleID}}.playfabapi.com/Admin/UpdatePlayerStatisticDefinition
    Content-Type: application/json
    X-SecretKey: <developer_secret_key>
{
  "StatisticName": "headshots",
  "VersionChangeInterval": "Day"
}
        

Response Details

UpdatePlayerStatisticDefinitionResult
Result Properties
Statistic PlayerStatisticDefinition

updated statistic definition

Sample Response

HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
{
  "code": 200,
  "status": "OK",
  "data": {
    "Statistic": {
      "StatisticName": "headshots",
      "CurrentVersion": 2,
      "DeletionInProgress": false,
      "VersionChangeInterval": "Day",
      "AggregationMethod": "Last"
    }
  }
}

Authentication

SecretKey

Possible Error Codes

Name Code
StatisticNotFound 1195
StatisticUpdateInProgress 1276