API reference
API reference
Select your platform
No SDKs available
No versions available

Leaderboards Class

The Leaderboards API provides a way to manage and interact with leaderboards in your application. The API allows you to retrieve information about a single leaderboard, write entries to a leaderboard, and retrieve blocks of leaderboard entries based on different criterias. Leaderboard-integrated apps get Challenges for free, accessible through the Scoreboards UI. Visit our website for more information about leaderboards.

Static Methods

Get ( leaderboardName )
Retrieves detailed information for a single leaderboard with a specified name, returning an array of Models.Leaderboard.
Signature
static Request<Models.LeaderboardList> Oculus.Platform.Leaderboards.Get(string leaderboardName)
Parameters
leaderboardName: string  The name of the leaderboard to retrieve.
GetEntries ( leaderboardName , limit , filter , startAt )
Retrieves a list of leaderboard entries for a specified leaderboardName, with options to filter and limit the number of results returned. Error codes
  • 100: Parameter {parameter}: invalid user id: {user_id}
  • 100: Something went wrong.
  • 12074: You're not yet ranked on this leaderboard.
Signature
static Request<Models.LeaderboardEntryList> Oculus.Platform.Leaderboards.GetEntries(string leaderboardName, int limit, LeaderboardFilterType filter, LeaderboardStartAt startAt)
Parameters
leaderboardName: string  The name of the leaderboard from which to retrieve entries.
limit: int  Specifies the maximum number of entries to be returned.
filter: LeaderboardFilterType  By using ovrLeaderboard_FilterFriends, this allows you to filter the returned values to bidirectional followers.
startAt: LeaderboardStartAt  Defines whether to center the query on the user or start at the top of the leaderboard.
GetEntriesAfterRank ( leaderboardName , limit , afterRank )
Retrieves a block of leaderboard entries starting from a specific rank.
Signature
static Request<Models.LeaderboardEntryList> Oculus.Platform.Leaderboards.GetEntriesAfterRank(string leaderboardName, int limit, ulong afterRank)
Parameters
leaderboardName: string  The name of the leaderboard from which to retrieve entries.
limit: int  The maximum number of entries to return.
afterRank: ulong  The position after which to start. For example, 10 returns leaderboard results starting with the 11th user.
GetEntriesByIds ( leaderboardName , limit , startAt , userIDs )
Retrieves a block of leaderboard entries that match the specified user IDs. Only entries corresponding to the provided user IDs will be returned.
Signature
static Request<Models.LeaderboardEntryList> Oculus.Platform.Leaderboards.GetEntriesByIds(string leaderboardName, int limit, LeaderboardStartAt startAt, UInt64[] userIDs)
Parameters
leaderboardName: string  The name of the leaderboard from which to retrieve entries.
limit: int  The maximum number of entries to return.
startAt: LeaderboardStartAt  Defines whether to center the query on the user or start at the top of the leaderboard. If this is LeaderboardStartAt.CenteredOnViewer or LeaderboardStartAt.CenteredOnViewerOrTop, then the current user's ID will be automatically added to the query.
userIDs: UInt64 []  Defines a list of user ids to get entries for.
GetNextEntries ( list )
Signature
static Request<Models.LeaderboardEntryList> Oculus.Platform.Leaderboards.GetNextEntries(Models.LeaderboardEntryList list)
GetNextLeaderboardListPage ( list )
Signature
static Request<Models.LeaderboardList> Oculus.Platform.Leaderboards.GetNextLeaderboardListPage(Models.LeaderboardList list)
Parameters
GetPreviousEntries ( list )
Signature
static Request<Models.LeaderboardEntryList> Oculus.Platform.Leaderboards.GetPreviousEntries(Models.LeaderboardEntryList list)
WriteEntry ( leaderboardName , score , extraData , forceUpdate )
Writes a single entry to the leaderboard, returning Models.LeaderboardUpdateStatus indicating whether the update was successful and providing the updated challenge IDs. Error codes
  • 100: Parameter {parameter}: invalid user id: {user_id}
  • 100: Something went wrong.
  • 100: This leaderboard entry is too late for the leaderboard's allowed time window.
Signature
static Request<bool> Oculus.Platform.Leaderboards.WriteEntry(string leaderboardName, long score, byte[] extraData=null, bool forceUpdate=false)
Parameters
leaderboardName: string  The name of the leaderboard to which the entry should be written.
score: long  The score to be written in the leaderboard.
extraData: byte []  A 2KB custom data field that is associated with the leaderboard entry. This can be a game replay or any additional information that provides more context about the entry for the viewer.
forceUpdate: bool  If true, the score always updates. This happens even if it is not the user's best score.
Returns
Request< bool >
WriteEntryWithSupplementaryMetric ( leaderboardName , score , supplementaryMetric , extraData , forceUpdate )
Writes a single entry to a leaderboard which can include supplementary metrics, returning Models.LeaderboardUpdateStatus indicating whether the update was successful and providing the updated challenge IDs. Error codes
  • 100: Parameter {parameter}: invalid user id: {user_id}
  • 100: Something went wrong.
  • 100: This leaderboard entry is too late for the leaderboard's allowed time window.
Signature
static Request<bool> Oculus.Platform.Leaderboards.WriteEntryWithSupplementaryMetric(string leaderboardName, long score, long supplementaryMetric, byte[] extraData=null, bool forceUpdate=false)
Parameters
leaderboardName: string  The name of the leaderboard to which the entry should be written.
score: long  The score to be written in the leaderboard.
supplementaryMetric: long  Supplemental piece of data that can be used for tiebreakers.
extraData: byte []  A 2KB custom data field that is associated with the leaderboard entry. This can be a game replay or any additional information that provides more context about the entry for the viewer.
forceUpdate: bool  If true, the score always updates. This happens even if it is not the user's best score.
Returns
Request< bool >