Workouts Create - TrainingPeaks/PartnersAPI GitHub Wiki
Allows a coach or athlete to plan workouts on an athlete’s calendar.
- Resource endpoint: /v2/workouts/plan
- HTTP Method: POST
- OAuth Scope Required: workouts:plan (if the athlete is the user, athlete:profile is also required to get the athlete ID)
- Trying to create future planned workout for basic athletes will result in 403 status code
- Input:
- The athlete id: Required.
- The workout day: Required.
- The workout day can not be more than 7 days in the past or more than a year in the future.
- Format: yyyy-MM-dd or yyyy-MM-ddT00:00:00 (ISO 8601) without time zone information
- *any time information passed will be ignored.
- The workout type: Required.
- valid types: swim, bike, run, x-train, mtb, strength, xc-ski, rowing, walk, other
- Optional Object Properties:
Property | Type | Units | Values | Notes |
---|---|---|---|---|
Title | string | |||
Description | string | |||
StartTimePlanned | string | Date/Time without time zone info | Format: yyyy-MM-dd HH:mm:ss or yyyy-MM-ddTHH:mm:ss | |
TotalTimePlanned | double | Hours in decimal form. 2 hours, 30 minute = 2.5 | Max: 99:59:59 | See Additional Notes below |
DistancePlanned | double | meters | Max: 99999999 | |
TSSPlanned | double | Max: 9999 | See Additional Notes below | |
IFPlanned | double | Max: 5 | See Additional Notes below | |
CaloriesPlanned | double | k/cals | Max: 99999 | |
EnergyPlanned | double | kilojoules | Max: 99999 | |
ElevationGainPlanned | double | meters | Max: 99999 | |
Locked | bool | Only available to coaches | ||
Hidden | bool | Only available to coaches | ||
Structure | json string | Workout Structure Object | ||
StructureDisplayUnit | string | Options: meter, mile, kilometer, yard | Sets the distance unit used to display in the Workout Builder in TrainingPeaks. (Optional value, meter by default) | |
Tags | string array | an array of tags for this workout |
Additional Notes
- When valid non-RPE based structure is uploaded for workouts, TotalTimePlanned, TSSPlanned, and IFPlanned values will be ignored.
- For Distance based structured workouts, not setting speed threshold in athlete's profile will result in empty TotalTimePlanned, TSSPlanned, and IFPlanned.
- See the Workout Object for more detail
Example:
Testing:
https://api.sandbox.trainingpeaks.com/v2/workouts/plan
Production:
https://api.trainingpeaks.com/v2/workouts/plan
Example of how to format your data.
{
"AthleteId": "134129",
"Title": "Example Plan",
"WorkoutDay": "2017-06-26",
"TotalTimePlanned": "1",
"WorkoutType": "run",
"Structure": "[ { \"IntensityClass\": \"WarmUp\", \"Name\": \"Warm up\", \"Length\": { \"Unit\": \"Second\", \"Value\": 600 }, \"Type\": \"Step\", \"IntensityTarget\": { \"Unit\": \"PercentOfThresholdHr\", \"Value\": 75, \"MinValue\": 70, \"MaxValue\": 80 } }, { \"IntensityClass\": \"Active\", \"Name\": \"Active\", \"Length\": { \"Unit\": \"Second\", \"Value\": 2095 }, \"Type\": \"Step\", \"IntensityTarget\": { \"Unit\": \"PercentOfThresholdHr\", \"Value\": 90, \"MinValue\": 80, \"MaxValue\": 100 } }, { \"Type\": \"Repetition\", \"Length\": { \"Unit\": \"Repetition\", \"Value\": 3 }, \"Steps\": [ { \"IntensityClass\": \"Active\", \"Name\": \"Hard\", \"Length\": { \"Unit\": \"Second\", \"Value\": 60 }, \"Type\": \"Step\", \"IntensityTarget\": { \"Unit\": \"PercentOfThresholdHr\", \"Value\": 115 }, \"CadenceTarget\": { \"Unit\": \"rpm\", \"MinValue\": 70, \"MaxValue\": 80 } }, { \"IntensityClass\": \"Rest\", \"Name\": \"Easy\", \"Length\": { \"Unit\": \"Second\", \"Value\": 60 }, \"Type\": \"Step\", \"IntensityTarget\": { \"Unit\": \"PercentOfThresholdHr\", \"Value\": 70 } } ] }, { \"IntensityClass\": \"CoolDown\", \"Name\": \"Cool Down\", \"Length\": { \"Unit\": \"Second\", \"Value\": 600 }, \"Type\": \"Step\", \"IntensityTarget\": { \"Unit\": \"PercentOfThresholdHr\", \"Value\": 75 }, \"OpenDuration\": true }]"
}