Saltar al contenido principal
GET
/
users
/
{id}
/
points
/
{key}
JavaScript
import { TrophyApiClient } from '@trophyso/node';

const trophy = new TrophyApiClient({
  apiKey: 'YOUR_API_KEY'
});

const response = await trophy.users.points("user-id", "points-system-key");
{
  "id": "0040fe51-6bce-4b44-b0ad-bddc4e123534",
  "key": "xp",
  "name": "XP",
  "description": null,
  "badgeUrl": null,
  "maxPoints": null,
  "total": 100,
  "level": {
    "id": "1140fe51-6bce-4b44-b0ad-bddc4e123534",
    "key": "silver",
    "name": "Silver",
    "description": "Mid-tier level",
    "badgeUrl": null,
    "points": 50
  },
  "awards": [
    {
      "id": "0040fe51-6bce-4b44-b0ad-bddc4e123534",
      "awarded": 10,
      "date": "2021-01-01T00:00:00Z",
      "total": 100,
      "trigger": {
        "id": "0040fe51-6bce-4b44-b0ad-bddc4e123534",
        "type": "metric",
        "points": 10,
        "metricName": "words written",
        "metricThreshold": 1000
      }
    }
  ]
}
Límites de tasa

Autorizaciones

X-API-KEY
string
header
requerido

Parámetros de ruta

id
string
requerido

ID of the user.

key
string
requerido

Key of the points system.

Parámetros de consulta

awards
integer
predeterminado:10

The number of recent point awards to return.

Rango requerido: 1 <= x <= 100

Respuesta

Successful operation

Base points system fields shared across responses.

id
string
requerido

The ID of the points system

key
string
requerido

The key of the points system

name
string
requerido

The name of the points system

description
string | null
requerido

The description of the points system

badgeUrl
string | null
requerido

The URL of the badge image for the points system

maxPoints
number | null
requerido

The maximum number of points a user can be awarded in this points system

total
integer
requerido

The user's total points

level
PointsLevel · object
requerido

The user's current level in this points system, or null if no levels are configured or the user hasn't reached any level yet.

awards
PointsAward · object[]
requerido

Array of trigger awards that added points.