Documentation

GetPlayerStatistics

Retrieves the current version and values for the indicated statistics, for the local player.

Request Details

GetPlayerStatisticsRequest
Request Properties
PlayFabId (required) String

user for whom statistics are being requested

StatisticNames List<String>

statistics to return

StatisticNameVersions List<StatisticNameVersion>

statistics to return, if StatisticNames is not set (only statistics which have a version matching that provided will be returned)

POST https://{{TitleID}}.playfabapi.com/Server/GetPlayerStatistics
    Content-Type: application/json
    X-SecretKey: <developer_secret_key>
{
  "PlayFabId": "621EF2023753444",
  "StatisticNames": [
    "Points",
    "Wins"
  ]
}
        

Response Details

In addition to being available for use by the title, the statistics are used for all leaderboard operations in PlayFab.

GetPlayerStatisticsResult
Result Properties
PlayFabId String

PlayFab unique identifier of the user whose statistics are being returned

Statistics List<StatisticValue>

User statistics for the requested user.

Sample Response

HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
{
  "code": 200,
  "status": "OK",
  "data": {
    "PlayFabId": "621EF2023753444",
    "Statistics": [
      {
        "StatisticName": "Points",
        "Value": 570,
        "Version": 1
      },
      {
        "StatisticName": "Wins",
        "Value": 15,
        "Version": 0
      }
    ]
  }
}

Authentication

SecretKey

Possible Error Codes

Name Code
AccountNotFound 1001