Player Data Management - Update Player Statistics
Updates the values of the specified title-specific statistics for the user
POST https://titleId.playfabapi.com/Server/UpdatePlayerStatistics
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 |
---|---|---|---|
PlayFabId | True |
string |
Unique PlayFab assigned ID of the user on whom the operation will be performed. |
Statistics | True |
Statistics to be updated with the provided values |
|
CustomTags |
object |
The optional custom tags associated with the request (e.g. build number, external trace identifiers, etc.). |
|
ForceUpdate |
boolean |
Indicates whether the statistics provided should be set, regardless of the aggregation method set on the statistic. Default is false. |
Responses
Name | Type | Description |
---|---|---|
200 OK | ||
400 Bad Request |
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 |
---|---|
Api |
The basic wrapper around every failed API response |
Statistic |
|
Update |
This operation is additive. Statistics not currently defined will be added, while those already defined will be updated with the given values. All other user statistics will remain unchanged. |
Update |
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 |
StatisticUpdate
Name | Type | Description |
---|---|---|
StatisticName |
string |
unique name of the statistic |
Value |
number |
statistic value for the player |
Version |
number |
for updates to an existing statistic value for a player, the version of the statistic when it was loaded. Null when setting the statistic value for the first time. |
UpdatePlayerStatisticsRequest
This operation is additive. Statistics not currently defined will be added, while those already defined will be updated with the given values. All other user statistics will remain unchanged.
Name | Type | Description |
---|---|---|
CustomTags |
object |
The optional custom tags associated with the request (e.g. build number, external trace identifiers, etc.). |
ForceUpdate |
boolean |
Indicates whether the statistics provided should be set, regardless of the aggregation method set on the statistic. Default is false. |
PlayFabId |
string |
Unique PlayFab assigned ID of the user on whom the operation will be performed. |
Statistics |
Statistics to be updated with the provided values |
UpdatePlayerStatisticsResult
Error Codes
Name | Code |
---|---|
DuplicateStatisticName | 1253 |
StatisticCountLimitExceeded | 1203 |
StatisticNameConflict | 1196 |
StatisticNotFound | 1195 |
StatisticValueAggregationOverflow | 1308 |
StatisticVersionClosedForWrites | 1197 |
StatisticVersionInvalid | 1198 |