Documentation

GetLeaderboardAroundPlayer

Retrieves a list of ranked users for the given statistic, centered on the requested player. If PlayFabId is empty or null will return currently logged in user.

Request Details

GetLeaderboardAroundPlayerRequest
Request Properties
MaxResultsCount int32

Maximum number of entries to retrieve. Default 10, maximum 100.

PlayFabId String

PlayFab unique identifier of the user to center the leaderboard around. If null will center on the logged in user.

ProfileConstraints PlayerProfileViewConstraints

If non-null, this determines which properties of the resulting player profiles to return. For API calls from the client, only the allowed client profile properties for the title may be requested. These allowed properties are configured in the Game Manager "Client Profile Options" tab in the "Settings" section.

StatisticName (required) String

Statistic used to rank players for this leaderboard.

UseSpecificVersion (Governs: Version) Boolean

If set to false, Version is considered null. If true, uses the specified Version

Version int32

The version of the leaderboard to get.

POST https://{{TitleID}}.playfabapi.com/Client/GetLeaderboardAroundPlayer
    Content-Type: application/json
    X-Authentication: <user_session_ticket_value>
{
  "StatisticName": "Kills",
  "MaxResultsCount": 20
}
        

Response Details

Note: When calling 'GetLeaderboardAround...' APIs, the position of the user defaults to 0 when the user does not have the corresponding statistic.

GetLeaderboardAroundPlayerResult
Result Properties
Leaderboard List<PlayerLeaderboardEntry>

Ordered listing of users and their positions in the requested leaderboard.

NextReset DateTime

The time the next scheduled reset will occur. Null if the leaderboard does not reset on a schedule.

Version (required) int32

The version of the leaderboard returned.

Sample Response

HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
{
  "code": 200,
  "status": "OK",
  "data": {
    "Leaderboard": [
      {
        "PlayFabId": "10931252888739651331",
        "DisplayName": "username",
        "StatValue": 12,
        "Position": 0
      }
    ],
    "Version": 0
  }
}

Authentication

SessionTicket

Possible Error Codes

Name Code
AccountNotFound 1001
LeaderboardVersionNotAvailable 1277