Documentation

GetFriendLeaderboard

Retrieves a list of ranked friends of the given player for the given statistic, starting from the indicated point in the leaderboard

Request Details

GetFriendLeaderboardRequest
Request Properties
IncludeFacebookFriends Boolean

Indicates whether Facebook friends should be included in the response. Default is true.

IncludeSteamFriends Boolean

Indicates whether Steam service friends should be included in the response. Default is true.

MaxResultsCount (required) int32

Maximum number of entries to retrieve.

PlayFabId (required) String

The player whose friend leaderboard to get

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.

StartPosition (required) int32

Position in the leaderboard to start this listing (defaults to the first entry).

StatisticName (required) String

Statistic used to rank friends 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.

XboxToken String

Xbox token if Xbox friends should be included. Requires Xbox be configured on PlayFab.

POST https://{{TitleID}}.playfabapi.com/Server/GetFriendLeaderboard
    Content-Type: application/json
    X-SecretKey: <developer_secret_key>
{
  "PlayFabId": "98092347523",
  "StatisticName": "Kills",
  "StartPosition": 1258,
  "MaxResultsCount": 20,
  "IncludeSteamFriends": false
}
        

Response Details

Note that the Position of the user in the results is for the overall leaderboard. If Facebook friends are included, make sure the access token from previous LoginWithFacebook call is still valid and not expired.

GetLeaderboardResult
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,
        "Profile": {
          "AvatarUrl": "https://example.org/profile.jpg",
          "Statistics": [
            {
              "Name": "Points",
              "Version": 2,
              "Value": 15
            },
            {
              "Name": "XP",
              "Version": 1,
              "Value": 10
            }
          ]
        }
      }
    ],
    "Version": 0
  }
}

Authentication

SecretKey

Possible Error Codes

Name Code
FacebookAPIError 1143