Fetching Data

With GraphQL, you request only the data you need, and the response contains exactly that—no more, no less. The complexity of retrieving and assembling the data is handled by the server, not the client. Depending on the type and amount of data requested, the server may perform more or fewer internal operations, allowing it to optimise the response for your specific request.

For example, when requesting an event, if you don’t include the associated collection of competitors, they won’t be loaded or returned in the response.

Request: Including details of each competitor
query GetEvents {
  events {
    nodes {
      id
      name
      scheduledStartDateTime {
        iso8601
      }
      status,
      venue {
        id
        name
        country {
          alpha2Code
        }
      }
      eventCompetitors {
        nodes {
          id
          name
        }
      }
    }
  }
}
Response
{
  "data": {
    "events": {
      "nodes": [
        {
          "id": "120898",
          "name": "PUNCHESTOWN 12:45",
          "scheduledStartDateTime": {
            "iso8601": "2023-05-23T12:45:00Z"
          },
          "status": "SCHEDULED",
          "venue": {
            "id": "81",
            "name": "Punchestown",
            "country": {
              "alpha2Code": "IE"
            }
          },
          "eventCompetitors": {
            "nodes": [
              {
                "id": "1208677",
                "name": "Benz"
              },
              {
                "id": "1208678",
                "name": "Fancy A Cosmo"
              },
              {
                "id": "1208679",
                "name": "Jimli's Cave"
              },
              {
                "id": "1208680",
                "name": "Scipio Africanus"
              },
              {
                "id": "1208681",
                "name": "No Trouble"
              },
              {
                "id": "1208682",
                "name": "Slige Dala"
              },
              {
                "id": "1208683",
                "name": "Ballyquin Bay"
              },
              {
                "id": "1208684",
                "name": "Mylestown Upper"
              },
              {
                "id": "1208685",
                "name": "The Bog Garden"
              },
              {
                "id": "1208686",
                "name": "Bal De Rio"
              },
              {
                "id": "1208687",
                "name": "Commandingpresence"
              },
              {
                "id": "1208688",
                "name": "Foreign Policy"
              },
              {
                "id": "1208689",
                "name": "Buzz Light"
              },
              {
                "id": "1208690",
                "name": "Mornington Bay"
              }
            ]
          }
        }
      ]
    }
  }
}

Request: Excluding details of each competitor
query GetEvents {
  events {
    nodes {
      name
      scheduledStartDateTime {
        iso8601
      }
    }
  }
}
Response
{
  "data": {
    "events": {
      "nodes": [
        {
          "name": "PUNCHESTOWN 12:45",
          "scheduledStartDateTime": {
            "iso8601": "2023-05-23T12:45:00Z"
          }
        }
      ]
    }
  }
}