MENU navbar-image

Introduction

Microsserviço de rankings e métricas de jogos para integração com o ecossistema GameVerse.

Esta API expõe rankings semanais, mensais e anuais, jogos mais jogados e histórico de pontuação.

<aside>Use os exemplos da documentação para demonstrar como o frontend ou outros microsserviços podem consumir os dados de ranking.</aside>

Authenticating requests

To authenticate requests, include an Authorization header with the value "Bearer {YOUR_JWT_TOKEN}".

All authenticated endpoints are marked with a requires authentication badge in the documentation below.

Use um token JWT RS256 emitido pelo serviço de autenticação integrado ao GameVerse.

Rankings

Top semanal

requires authentication

Retorna o ranking dos jogos com melhor desempenho na última semana.

Example request:
curl --request GET \
    --get "http://127.0.0.1:8000/api/v1/rankings/weekly" \
    --header "Authorization: Bearer {YOUR_JWT_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "http://127.0.0.1:8000/api/v1/rankings/weekly"
);

const headers = {
    "Authorization": "Bearer {YOUR_JWT_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};


fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Example response (401):

Show headers
cache-control: no-cache, private
content-type: application/json
x-ratelimit-limit: 60
x-ratelimit-remaining: 54
access-control-allow-origin: *
 

{
    "message": "Invalid or expired token"
}
 

Request      

GET api/v1/rankings/weekly

Headers

Authorization        

Example: Bearer {YOUR_JWT_TOKEN}

Content-Type        

Example: application/json

Accept        

Example: application/json

Top mensal

requires authentication

Retorna o ranking dos jogos com melhor desempenho no último mês.

Example request:
curl --request GET \
    --get "http://127.0.0.1:8000/api/v1/rankings/monthly" \
    --header "Authorization: Bearer {YOUR_JWT_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "http://127.0.0.1:8000/api/v1/rankings/monthly"
);

const headers = {
    "Authorization": "Bearer {YOUR_JWT_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};


fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Example response (401):

Show headers
cache-control: no-cache, private
content-type: application/json
x-ratelimit-limit: 60
x-ratelimit-remaining: 53
access-control-allow-origin: *
 

{
    "message": "Invalid or expired token"
}
 

Request      

GET api/v1/rankings/monthly

Headers

Authorization        

Example: Bearer {YOUR_JWT_TOKEN}

Content-Type        

Example: application/json

Accept        

Example: application/json

Top anual

requires authentication

Retorna o ranking dos jogos com melhor desempenho no último ano.

Example request:
curl --request GET \
    --get "http://127.0.0.1:8000/api/v1/rankings/yearly" \
    --header "Authorization: Bearer {YOUR_JWT_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "http://127.0.0.1:8000/api/v1/rankings/yearly"
);

const headers = {
    "Authorization": "Bearer {YOUR_JWT_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};


fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Example response (401):

Show headers
cache-control: no-cache, private
content-type: application/json
x-ratelimit-limit: 60
x-ratelimit-remaining: 52
access-control-allow-origin: *
 

{
    "message": "Invalid or expired token"
}
 

Request      

GET api/v1/rankings/yearly

Headers

Authorization        

Example: Bearer {YOUR_JWT_TOKEN}

Content-Type        

Example: application/json

Accept        

Example: application/json

Histórico de ranking

requires authentication

Retorna a evolução de um jogo específico ao longo do tempo.

Example request:
curl --request GET \
    --get "http://127.0.0.1:8000/api/v1/rankings/history/1" \
    --header "Authorization: Bearer {YOUR_JWT_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "http://127.0.0.1:8000/api/v1/rankings/history/1"
);

const headers = {
    "Authorization": "Bearer {YOUR_JWT_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};


fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Example response (401):

Show headers
cache-control: no-cache, private
content-type: application/json
x-ratelimit-limit: 60
x-ratelimit-remaining: 51
access-control-allow-origin: *
 

{
    "message": "Invalid or expired token"
}
 

Request      

GET api/v1/rankings/history/{id}

Headers

Authorization        

Example: Bearer {YOUR_JWT_TOKEN}

Content-Type        

Example: application/json

Accept        

Example: application/json

URL Parameters

id   integer     

O ID do jogo. Example: 1

Jogos mais jogados

requires authentication

Retorna o top 10 jogos com base no número de jogadores ativos.

Example request:
curl --request GET \
    --get "http://127.0.0.1:8000/api/v1/games/most-played" \
    --header "Authorization: Bearer {YOUR_JWT_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "http://127.0.0.1:8000/api/v1/games/most-played"
);

const headers = {
    "Authorization": "Bearer {YOUR_JWT_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};


fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Example response (401):

Show headers
cache-control: no-cache, private
content-type: application/json
x-ratelimit-limit: 60
x-ratelimit-remaining: 50
access-control-allow-origin: *
 

{
    "message": "Invalid or expired token"
}
 

Request      

GET api/v1/games/most-played

Headers

Authorization        

Example: Bearer {YOUR_JWT_TOKEN}

Content-Type        

Example: application/json

Accept        

Example: application/json