API Reference

Modify athlete measurements

The modifyMeasurements mutation allows you to modify measurements for athletes at your institution.

The mutation accepts a single metrics argument, which should be an array of MeasurementInput objects.

mutation {
  modifyMeasurements(
    metrics: # [MeasurementsInput] Array of MeasurementsInput objects
  )
}

MeasurementsInput

The MeasurementsInput object identifies which metric you want to record data for along with the measurements you want to record.

mutation {
  modifyMeasurements(
    metrics: [
      {
        uuid: "string",
        measurements: # [MeasurementInput] Array of MeasurementInput objects
    ]
  )
}

uuid* [String]

The uuid tells FYTT which metric to record measurements for. The UUID is automatically generated for every metric in FYTT, and can be found by navigating to the metric within the UI and scrolling down to the bottom:

measurements* [MeasurementIinput]

The measurements argument should be an array of MeasurementInput objects.

MeasurementInput

Each MeasurementInput object represents a single measurement for a given athlete on a given date for the given metric.

athleteEmail* String

The athleteEmail is how you identify which athlete the measurement is for. The email must correspond to an email for an athlete that already exists in FYTT. If we can't find an athlete with the given email, no record will be created (required if no athleteUuid provided).

athleteUuid* String

The athleteUuid is how you identify which athlete the measurement is for. This value is generated by FYTT for each athlete and can be obtained by querying institution.athletes (required if no athleteEmail provided).

date* ISO 8601 String

The date is the date that the measurement took place on. If a measurement already exists in FYTT for a given athlete on a given date, the value of that measurement will be updated with the new value provided. Otherwise, a new record will be created for the athlete with the measurement date and value provided.

value* Float

The value attribute is the value of the measurement. The unit of measurement for the metric is specified on the metric object, which can be accessed via the application UI, or it can accessed by querying the metric through the API.

delete Boolean

The delete attribute can be set to true to flag the measurement for deletion. If a measurement exists for the athlete on the given date, the record will be deleted.

Sample Mutation

Putting it all together, a sample mutation might look something like the following:

mutation {
  modifyMeasurements(
    metrics: [
      {
        uuid: "bc7ec5fe-8508-4c11-bbd1-29be86a1f77e",
        measurements: [
          {
            athleteEmail: "[email protected]", # Alternatively, use athleteUuid.
            date: "2023-10-01",
            value: 195
          },
          {
            athleteEmail: "[email protected]",
            date: "2023-10-01",
            value: 175
          }
        ]
      },
      {
        uuid: "8ec74779-49ed-431c-a3eb-9271a4f22336",
        measurements: [
          {
            athleteEmail: "[email protected]",
            date: "2023-10-01",
            value: 155
          },
          {
            athleteEmail: "[email protected]",
            date: "2023-10-01",
            value: 145
          }
        ]
      }
    ]
  ) {
    metrics {
      name
    }
  }
}

This would return a JSON response like the following:

{
  "data": {
    "modifyMeasurements": {
      "metrics": [
        {
          "name": "Back Squat 1RM"
        },
        {
          "name": "Bench Press 1RM"
        }
      ]
    }
  }
}

* indicates required attribute

⚠️

Avoid Request Timeouts

Requests will be much more performant if they're scoped by metric rather than by athlete. In other words, you'll get the best performance if you send measurements for many athletes for a single metric. Performance will be worse if you send measurements for many metrics for a single athlete.