Hi! Is there a problem today? API don’t import ID activity from Strava.
Which endpoint are you calling?
/api/v1/athlete/{id}/activities.csv
thanks
It is working for me. Are some activities missing? Can you see the same on your calendar?
Solved, thanks. that was my problem.
You can now download planned workouts:
GET /api/v1/athlete/{id}/events/{eventId}/download{ext}
Download a planned workout in .zwo, .mrc or .erg format.
Some changes to the endpoints that create/update workouts on the calendar and in folders:
- The workout description is now parsed. This means that workouts created or updated via the API have training load calculated and get “time in zones” and so on. This also applies to workouts synced from an external calendar.
- You can now create/update workouts from zwo, mrc and erg files.
POST /api/v1/athlete/{id}/events
{
"category": "WORKOUT",
"start_date_local": "2021-04-29T00:00:00",
"type": "Ride",
"filename": "4x8m.zwo",
"file_contents": "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<workout_file>..."
}
Response:
{
"id": 610062,
"icu_training_load": 116,
...
"name": "4x8m VO2 Max",
"description": "These are horribly nasty.\nCategory: Horrible\n\n- 20m 60% 90-100rpm\n\nMain set 4x\n- 8m 110%\n- 8m 50%\n\n- 10m 60%\n",
...
"workout_doc": {
"steps": [
{
"power": {"units": "%ftp", "value": 60},
"cadence": {"end": 100, "start": 90, "units": "rpm"}, "duration": 1200
}, ...
],
"duration": 5640,
"zoneTimes": [1920, 1800, 0, 0, 1920, 0, 0, 0],
"hrZoneTimes": [1920, 1800, 0, 0, 1920, 0, 0, 0]
},
"icu_intensity": 86.04798
}
Is there an endpoint to post .fit files to?
For completed activities or planned workouts? You can upload completed activities:
POST /v1/athlete/{id}/activities
This accepts form data with ‘file’ containing the data as well as optional name and description fields. The file can be .fit, .gpx, .fit.gz, .gpx.gz or a zip file containing one or more of the same.
It won’t create duplicate activities (hash of file data is checked). It returns status code 201 if at least one activity was created, else 200. The body is an array of { icu_athlete_id, id } for each activity.
This is really interesting! Thanks for all the great work.
Having a play with this, is there a way to get just the last activity full data set instead of all of them, for the activities.csv endpoint?
Cheers!
Tx. You can do:
GET /api/v1/athlete/{id}/activities?oldest=2019-07-22T16:18:49&newest=2019-08-23T12:18:24
To list activities in JSON format between 2 local dates in local date order.
GET /api/v1/activity/{id}
to get a single activity in JSON format
GET /api/v1/activity/{id}/file
to get the raw file for a single activity (if available)
You can also upload new activities:
POST /api/v1/athlete/{id}/activities
Accepts form data with ‘file’ being the fit, gpx or tax file. Also optional name and description. De-dups uploaded files on content hash.
G’day david,
I’m encountering an issue with the activities.csv export.
Seemingly at random, some rows have too many columns.
Here is an example.
Inspecting the .csv, here is the plain text content for row 7:
...,false,false,false,1728,,,,,,,145,143,10897,717,..."
It would appear that between icu_recording_time
and icu_pm_cp
there ought to be six commas, but there are seven for some reason.
This exhibits itself randomly throughout my csv file.
Cheers!
Tx. I have fixed this for deploy Friday AM (GMT+2). Rows with no hrrc data were shifted over. Sorry about that.
Hi David;
Top work as always - is there a way to get headline stats for any of the riders you coach?
Ross
You mean for all of them at once or an individual athlete? What stats are you looking for?
Hi David,
Thanks for coming back to me -
I’m thinking an endpoint like /coach/overview
which would return the data found on this part of the screen
Assume it would be like
athletes: {
id : { fitneess: X , fatigue: X, Form: X, Weight: X, last7day: { load: x, hours: float },
id : { fitneess: X , fatigue: X, Form: X, Weight: X, last7day: { load: x, hours: float },
repeats for all coached riders
}
Something like the CSV link on that page? I have just added that to the API (will deploy Tues AM GMT+2):
GET /api/v1/athlete/{id}/athlete-summary{ext}?start=yyyy-MM-dd&end=yyyy-MM-dd
- Calculates totals by week
- Fitness, fatigue and form are as of the last activity completed in the week which may not be the last day of the week
-
ext
is .csv for CSV output and JSON otherwise -
tags
Optional comma separated list of athlete tags to only return those athletes
Note that the format of this is going to change. I still need to change ‘byCategory’ to bySport and include time in zones for power, HR and pace separately etc…
Hi -
How do I go about pulling planned activities for only today? eg: Today’s workout much like TP’s workout of the day
I tried to use this URL
https://intervals.icu/api/v1/athlete/{id}/events?oldest=2021-09-07&newest=2021-09-07
I placed 2 workouts, one on sept6 and sept7, I would like to get the activityID for only sept7 (which is today)
I can only get it to work if I put tomorrow’s date.
eg:
https://intervals.icu/api/v1/athlete/{id}/events?oldest=2021-09-08&newest=2021-09-08
@David could you please let me know what I’m doing wrong? Appreciate it. Thanks
I have fixed this. It would have worked if you included a time in newest e.g. 2021-09-07T23:59:59. The server now does that automatically.
TQ! I could have sworn that I saw in a post somewhere that it was just the date w/o the time included as well.
in any case, Appreciate the help.