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
  }
]

Authorizations

X-API-KEY
string
header
required

Path Parameters

id
string
required

ID of the user.

key
string
required

Unique key of the metric.

Query Parameters

aggregation
enum<string>
required

The time period over which to aggregate the event data.

Available options:
daily,
weekly,
monthly
startDate
string<date>
required

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>
required

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.

Response

Successful operation

date
string<date>
required

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

Example:

"2024-01-01"

total
number
required

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

Example:

100

change
number
required

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

Example:

50