Endpoints

Leaderboard API Documentation

This endpoint is used to update the leaderboard with the player's latest skill data. It requires several pieces of information about the player and the game mode they are playing in.

Endpoint URL

POST https://api.teamgames.io/v3/leaderboard/metrics/update

Headers

HeaderTypeDescription

Authorization

string

Bearer token for API key authentication

Request Body

ParameterTypeDescriptionRequired

gameMode

string

Game mode identifier

Yes

playerName

string

Player name

Yes

ipAddress

string

Player's IP address (optional)

No

userRole

string

Player's role (optional)

No

metrics

array

Array of player's skill or activity data (see below)

Yes

Each object in the skills array should have the following structure:

ParameterTypeDescription

name

string

Metric name

value

integer

Metric value

progress

integer

Metric progress

Response

The endpoint will return a response indicating the status of the leaderboard update.

Example Request

POST /api/v3/leaderboard/metrics/update
Authorization: Bearer <apiKey>
Content-Type: application/json

{
  "gameMode": "Normal Mode",
  "playerName": "Nelson",
  "metrics": [
    {
      "name": "Attack",
      "value": 99,
      "progress": 200000000
    },
    {
      "name": "Wins",
      "value": 1
    },
    ...
  ]
}

CURL Example

Here is an example of how to make a request to the Vote API using CURL:

curl -X POST "https://api.teamgames.io/v3/leaderboard/metrics/update" \
     -H "X-API-Key: your_api_key" \
     -H "Content-Type: application/x-www-form-urlencoded; charset=UTF-8" \
     --data-urlencode "gameMode=Normal Mode" \
     --data-urlencode "playerName=player123" \
     --data-urlencode "metrics=[
         {
             \"name\": \"Cooking\",
             \"value\": 99,
             \"progress\": 200000000
         },
         {
             \"name\": \"Wins\",
             \"value\": 10
         }
     ]"

Last updated