Introduction

For this topic we are going to look at how we might extend the recurring events topic here to add additional functionality which the new platform might not have. For this topic we will focus on resetting Leaderboards through the Lambda functions covered in the topic on recurring events.

Although we are focusing on resetting Leaderboards, this flow could be used to control anything you wish to update on a recurring basis using the new platform’s REST API. This is just an example which will help you reproduce some common GameSparks Leaderboard functionality.

Before starting anything you will need to set up a new AWS account. We won't cover this here but it is a simple process. Just go to aws.amazon.com to sign-up.

Beamable

REST API calls with beamable are straightforward. The only thing you will need is a bearer token and a scope header to be included with your request.

Admin Authentication

First we are going to need to get the bearer token from Beamable. We can use the basic-auth API here for this. You will also need the ‘X-DE-SCOPE’ header value which is your CID plus your PID joined with a dot in between them as in the example below…

curl --request POST \
     --url https://api.beamable.com/basic/auth/token \
     --header 'Accept: application/json' \
     --header 'Content-Type: application/json' \
     --header 'X-DE-SCOPE: <cid>.<pid> \
     --data '
{
     "username": "<your-admin-email-login>",
     "password": "<your-admin-password>",
     "grant_type": "password"
}

We can see an example of this using Postman. If your details are correct you should see your access token being returned.

Leaderboard Reset

Now, to drop our Leaderboard entries we are going to use the following API. This call is going to need the ‘X-DE-SCOPE’ header and the token, along with the full ID of the Leaderboard, as in the example below...

curl --request DELETE \
     --url https://api.beamable.com/object/leaderboards/leaderboards.Arena_us/entries \
     --header 'Accept: application/json' \
     --header 'Authorization: Bearer bdb26b32-a6c4-4a45-976a-60d8d3ad6448' \
     --header 'X-DE-SCOPE: <CID>.<PID>

Once again, we can check the result in Postman and you should get a valid response.

AccelByte

AccelByte already has resetting Leaderboards for daily, weekly and monthly resets out-of-the-box. You can see more on that feature here.