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.

At present, all data queries are nested within the institution entry point. In other words, to access something like all athlete emails, you will traverse the query tree starting with the institution:

query {
  institution {
    athletes {
      email
    }
  }
}