Fetch athlete KPI data
AthleteKpi
AthleteKpi
The AthleteKpi
object is primarily the access point for athlete athlete measurements for the given KPI. It is nested under the Athlete
object.
It also contains the generic KPI-level info as well (e.g. name
, unit
, etc.). See kpis
for information about KPI-level fields.
measurements(startDate: ISO 8601 String, endDate: ISO 8601 String)
=> [KpiMeasurement]
The measurements
field returns an array of KpiMeasurement
objects that were recorded for the athlete within the specified date range. It accepts two required arguments: a startDate
string in ISO 8601 format ("YYYY-MM-DD"
) to specify the beginning of the desired date range, and an endDate
string in ISO 8601 format to specify the end of the desired date range.
value
=> Float
The value
field returns a float that represents the athlete's most recent (or "current") measurement for the give KPI. It will return 0
if no measurements exists.
KpiMeasurement
KpiMeasurement
The KpiMeasurement
object contains information about an athlete measurement for the given KPI on a specific date.
athleteEmail
=> String
The athleteEmail
field returns the email of the athlete for whom the measurement was recorded.
date
=> ISO 8601 String
The date
field returns the date that the measurement was recorded in ISO 8601 format ("YYYY-MM-DD"
).
uuid
=> String
The uuid
field returns the UUID generated by FYTT for the object.
value
=> Float
The value
field returns the measurement's recorded numerical value as a float.
Sample Query
Example:
query {
athletes(emails:["[email protected]"]) {
name,
kpis(uuids:["f43feed5-106b-4ffc-8889-84e35a576159"]) {
measurements(startDate:"2024-06-01", endDate:"2024-12-31") {
date,
value
}
}
}
}
Response:
{
"data": {
"athletes": [
{
"name": "Devin Anderson",
"kpis": [
{
"measurements": [
{
"date": "2024-06-01",
"value": 370
},
{
"date": "2024-07-01",
"value": 375
},
{
"date": "2024-08-01",
"value": 385
},
{
"date": "2024-09-01",
"value": 380
},
{
"date": "2024-10-28",
"value": 395
},
{
"date": "2024-10-30",
"value": 410
}
]
}
]
}
]
}
}
Avoid Request Timeouts
The amount of data requested can easily spiral out of control if you're not careful. To avoid request timeouts for very large amounts of data, we strongly advise that you limit the scope of each request to a subset of athletes and/or a relatively narrow date range (~30 days is probably the upper end of the recommended range depending on the number of athletes and the frequency of recorded measurements).