Metrics Create - TrainingPeaks/PartnersAPI GitHub Wiki

This endpoint is obsolete.

Please see v2/metrics for more details.

Endpoint:

  • /v1/metrics
  • HTTP Method: POST
  • Required Scope: metrics:write
  • Input:
    • DateTime: UTC DateTime, will be truncated to the minute.
      • Note: The date cannot be more than 1 day in the future or less 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
  • Optional Parameters
    • TimeZoneId: string see IANA time zone id below.
      • If TimeZoneId is supplied, metrics will be displayed as local time in this time zone. Otherwise, metrics will be displayed as local time in user’s default time zone.
      • IANA time zone id
      • IANA Wiki

Input data structure example:

{
  "DateTime": "2016-02-18T06:00:00Z",
  "TimeZoneId": "America/Denver",
  "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: int, unique id for the metrics
    • AthleteId: int, TrainingPeaks athlete identifier
    • DateTime: UTC DateTime, truncated to the minute
    • TimeZoneId: string IANA time zone id, optional
    • UploadClient: string
    • Metrics: one or more non-null values

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