Tournaments API
Game implementation of the tournaments tool.
Last updated
Was this helpful?
Game implementation of the tournaments tool.
Last updated
Was this helpful?
After completing the ; For the implementation on the game side, we tried to make it in the simple but most secure way. Please, make sure to use the Development API key during the development and testing of your integration to work with a private tournament and avoid having test data in production. This key will only work for private tournaments.
We have defined two core endpoints: get tournaments and submit scores.
The first part of the implementation takes place on the game client/backend side. This first endpoint will provide the active tournaments for your game, given an API Key.
The most critical element will be the _id
field, as it will define which tournament you want to submit the player's score to in the second part of the implementation.
Please notice that you'll only be able to access private tournaments and submit scores using a Development API Key.
We recommend adding the active tournament with a visible component in the game so that the player can select and play to it (or instead set it as default).
GET
https://kend.elixir.app/sdk/v2/tournaments/
Retrieves all the tournaments for a given API Key.
filter
ALL or ACTIVE
Filter between ALL events or ACTIVE events. Default: "ACTIVE"
x-api-key*
String
Public Key available on the Developer Dashboard
This second part of the implementation is the most critical one. Here you'll submit each player score, which will affect its ranking and be displayed in the leaderboard.
Given the critical nature of this functionality, we need to insist on the importance of calling this method from the Game Server or Backend.
You won't be able to submit a score to a public event with a Development API Key
To implement this accurately, the game developer must never expose his private key. And this should be done server-side, not client-side!
POST
https://kend.elixir.app/sdk/v2/tournaments/:tournamentId/submit
x-api-key*
String
Public Key obtained in the developer dashboard
x-api-token*
String
Timestamp used in the API Signature
x-api-signature*
String
Generated RSA signature
Content-Type
String
'application/json'
userId
String
Elixir User Id.
externalUserId
String
Your unique identifier for that user. (displayed if not linked to Elixir)
scores*
Array
An Array of individual scores, with each element being an object of the shape
{ "scoreType": "<name>", "value": <number>}
If you want to extract the best out of the Elixir Tournaments feature, including these two endpoints will make you stand out:
You can access the tournament leaderboard via API to display it inside your game. Apart from the general ranking, you will have access to the player rank. In case you want to display it on your client or if you want to know the winners and assign rewards for a finished tournament.
GET
https://kend.elixir.app/sdk/v2/tournaments/:tournamentId/leaderboard
Obtain the total ranking for the tournament based on the sorting method you configured in the Dashboard. If you provide the player JWT, their rank will be included outside of the paginated entries.
tournamentId*
String
ID of the tournament
x-api-key*
String
Public Key obtained in the developer dashboard
authorization
String
Bearer JWT
startDate
Date
Starting date that you want to consider for the leaderboard.
endDate
Date
Ending date that you want to consider for the leaderboard. (f.e. "2022-12-31")
limit
Int
The number of entries you want to display. Intended for pagination (Default: 10)
skip
Int
The number of entries you want to skip. Intended for pagination (Default: 0)
As a verifiable source, this endpoint will provide all scores given a tournament and a specific period. This way, game developers can contrast their data against the data in Elixir to avoid malicious activity and fake scores.
GET
https://kend.elixir.app/sdk/v2/tournaments/:tournamentId/scores
Return the total tournament scores by user
x-api-key*
String
Public Key obtained in the developer dashboard
startDate
Date
Starting date that you want to consider for the calculation of the scores
endDate
Date
Ending date that you want to consider for the calculation of the scores. (f.e. "2022-12-31")
We have chosen to be extra cautious and secure it with an using your private API key. We use this signature method to be sure that the score is sent from a verified server and reduces vulnerabilities and exploits of malicious agents. This provides reliability to the leaderboards displayed in Elixir.
Saves a user scores for a specific tournament. Either userId
or externalUserId
must be provided. userId
represents the Elixir user Id, and will be linked to the Elixir account of the player to display their preferred username and avatar in the leaderboard, so we encourage you to use the User Info endpoint to retrieve the elixir Id of each player for the best looking tournament page.
The format of the scores must follow the scoreTypes defined on :
{ "scoreType": <scoreType>, "value": Number}