Queries allow you to fetch data from the FYTT API
Queries allow you to fetch data from FYTT. Below is a generic example of a GraphQL Query
:
query {
objectName {
objectAttribute
}
}
This query is fetching an object (objectName
) and asking for a particular attribute (objectAttribute
) on that object. With GraphQL queries, you get exactly what you ask for—nothing more, nothing less. So this query would return a simple JSON response like the following:
{
"data": {
"objectName": {
"objectAttribute": "attributeValue"
}
}
}
Entry Points
A GraphQL query is essentially a request for specific fields on an object. The "root" objects available through the API are known as "entry points." All queries must route through an entry point, then traverse down through the field hierarchy to obtain the desired data points.
The athletes
entry point allows you to fetch data for any athlete under the institution. Be careful not to make queries that are too broad in scope, otherwise you might run into request timeout issues. You might consider scoping your athlete queries through the teams
entry point (see below), or even by teams.groups
.
The institution
is highest level object in the data model. All other main-level entry points are essentially aliases for the an institution's associations.
query {
institution {
athletes {
email
}
}
}
The kpis
entry point allows you to query basic information about the institution's KPIs.
The kpvs
entry point allows you to query basic information about the institution's KPVs.
The teams
entry point allows you to query basic information about the institution's teams, as well as reach down into the team's athletes and groups.