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

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

const response = await trophy.users.metricEventSummary("user-id", "words-written", {
  aggregation: "daily",
  startDate: "2024-01-01",
  endDate: "2024-01-31"
});
[
  {
    "date": "2024-01-01",
    "total": 100,
    "change": 100
  },
  {
    "date": "2024-01-02",
    "total": 300,
    "change": 200
  },
  {
    "date": "2024-01-03",
    "total": 600,
    "change": 300
  }
]
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

Unique key of the metric.

Parámetros de consulta

aggregation
enum<string>
requerido

The time period over which to aggregate the event data.

Opciones disponibles:
daily,
weekly,
monthly
startDate
string<date>
requerido

The start date for the data range in YYYY-MM-DD format. The startDate must be before the endDate, and the date range must not exceed 400 days.

endDate
string<date>
requerido

The end date for the data range in YYYY-MM-DD format. The endDate must be after the startDate, and the date range must not exceed 400 days.

Respuesta

Successful operation

date
string<date>
requerido

The date of the data point. For weekly or monthly aggregations, this is the first date of the period.

Ejemplo:

"2024-01-01"

total
number<double>
requerido

The user's total for this metric at the end of this date.

Ejemplo:

100

change
number<double>
requerido

The change in the user's total for this metric during this period.

Ejemplo:

50