次の方法で共有


Player Data Management - Update Player Statistic Definition

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

POST https://titleId.playfabapi.com/Admin/UpdatePlayerStatisticDefinition

Request Header

Name Required Type Description
X-SecretKey True

string

This API requires a title secret key, available to title admins, from PlayFab Game Manager.

Request Body

Name Required Type Description
StatisticName True

string

unique name of the statistic

AggregationMethod

StatisticAggregationMethod

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

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)

Responses

Name Type Description
200 OK

UpdatePlayerStatisticDefinitionResult

400 Bad Request

ApiErrorWrapper

This is the outer wrapper for all responses with errors

Security

X-SecretKey

This API requires a title secret key, available to title admins, from PlayFab Game Manager.

Type: apiKey
In: header

Definitions

Name Description
ApiErrorWrapper

The basic wrapper around every failed API response

PlayerStatisticDefinition
StatisticAggregationMethod
StatisticResetIntervalOption
UpdatePlayerStatisticDefinitionRequest

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

UpdatePlayerStatisticDefinitionResult

ApiErrorWrapper

The basic wrapper around every failed API response

Name Type Description
code

integer

Numerical HTTP code

error

string

Playfab error code

errorCode

integer

Numerical PlayFab error code

errorDetails

object

Detailed description of individual issues with the request object

errorMessage

string

Description for the PlayFab errorCode

status

string

String HTTP code

PlayerStatisticDefinition

Name Type Description
AggregationMethod

StatisticAggregationMethod

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

CurrentVersion

number

current active version of the statistic, incremented each time the statistic resets

StatisticName

string

unique name of the statistic

VersionChangeInterval

StatisticResetIntervalOption

interval at which the values of the statistic for all players are reset automatically

StatisticAggregationMethod

Name Type Description
Last

string

Max

string

Min

string

Sum

string

StatisticResetIntervalOption

Name Type Description
Day

string

Hour

string

Month

string

Never

string

Week

string

UpdatePlayerStatisticDefinitionRequest

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

Name Type Description
AggregationMethod

StatisticAggregationMethod

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

StatisticName

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)

UpdatePlayerStatisticDefinitionResult

Name Type Description
Statistic

PlayerStatisticDefinition

updated statistic definition

Error Codes

Name Code
StatisticNotFound 1195
StatisticUpdateInProgress 1276