v2 Metrics Create - TrainingPeaks/PartnersAPI GitHub Wiki

Endpoint:

  • /v2/metrics
  • HTTP Method: POST
  • Required Scope: metrics:write
  • Input:
    • DateTime: Local DateTime as recorded; will be truncated to the minute
      • Note: The date cannot be more than 1 day in the future or more than 1 year in the past
    • UploadClient: string identifying the client uploading the metrics.
      • Typically this would be the name of your application or service.
    • One or more metric

Input data structure example:

{
  "DateTime": "2020-06-01T06:12:34",
  "UploadClient": "<<<The name of your app or service>>>",
  "HRV": 84.1,
  "WeightInKilograms": 68.1,
  "Steps": 12345,
  "Stress": "Low",
  "SleepQuality": "Good"
}

Returns:

  • 201 Created
  • Location header: location url to get created metrics
  • Data structure with the following fields:
    • MetricId: string, unique id for the metrics
    • AthleteId: int, TrainingPeaks athlete identifier
    • DateTime: datetime, local DateTime as recorded, without timezone qualification; truncated to the minute
    • UploadClient: string
    • Metrics: one or more non-null values

See GET v2/metrics/{metric id} for example return data.