Build Leaderboards
In your app or web page you may need to display the leaderboard for your customers. In that case you can make use of the Leaderboard API that can help you build the desired leaderboard UI in a flexible way that handles different cases.
The leaderboard API returns a list of customers ordered by their rank for a given period of time. A single element in the leaderboard list represents a customer with his status
Each customer element in the list has the customer's name, unique id, progress in the given period, rank among the leaderboard, and info about their VIP tier.
Note: Gameball doesn't currently support images for customers. In order to map your customers and their respective images, it has to be done manually.
The leaderboard API accepts two important filters (from, to) as query strings. These filters control the returned leaderboard time window. Let's consider the following scenarios:
Show today’s leaderboard
This can be done by sending the from query parameter as today’s date. Lets say today is the 24th of Dec 2021, then the request would be as following
Show last month leaderboard
This can be done by sending the from and to query filter setting the boundaries of last month. For example if the current month is December, and you are looking for the previous month's (November) leaderboard. Then we would be setting the from and to dates as below
Show the all time leaderboard
From and to filters are omitted from the request.
The leaderboard API can also be used to show a specific customer's rank by sending the Player Unique Id as a filter
This will return a playerRank
object with the leaderboard list within the response that shows the customer rank even if he is not listed within the leaderboard.
Last updated