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.
Hi @david
I was testing my app’s abiity to get the workouts for Today(WOD). Same like previous, i only have workouts on Sept6 and Sept7 (workoutname is same as the date to make it easier to understand)
Is the following expected given that you have indicated that the “server now does this automatically”?
In any case, knowing how the API expects the date, it’s no issue for me to do the “T23:59:59” (Which I am doing now and works)
intervals.icu/api/v1/athlete/{ID}/events?oldest=2021-09-05&newest=2021-09-05
No workouts
intervals.icu/api/v1/athlete/{ID}/events?oldest=2021-09-06&newest=2021-09-06
WorkoutName:Sept6
intervals.icu/api/v1/athlete/{ID}/events?oldest=2021-09-07&newest=2021-09-07
WorkoutName:Sept6
intervals.icu/api/v1/athlete/{ID}/events?oldest=2021-09-08&newest=2021-09-08
WorkoutName:Sept7
intervals.icu/api/v1/athlete/{ID}/events?oldest=2021-09-09&newest=2021-09-09
No Workout
intervals.icu/api/v1/athlete/{ID}/events?oldest=2021-09-05T00:00:00&newest=2021-09-05T23:59:59
No Workouts
intervals.icu/api/v1/athlete/{ID}/events?oldest=2021-09-06T00:00:00&newest=2021-09-06T23:59:59
WorkoutName:Sept6
intervals.icu/api/v1/athlete/{ID}/events?oldest=2021-09-07T00:00:00&newest=2021-09-07T23:59:59
WorkoutName:Sept7
intervals.icu/api/v1/athlete/{ID}/events?oldest=2021-09-08T00:00:00&newest=2021-09-08T23:59:59
No Workout
Looks like I have a few bugs to fix if you don’t supply time with the date.
feature request:
It would be great to have the GET /api/v1/activity/{id}
endpoint accept several {id}
s. My use case is retrieving all activities from /api/v1/athlete/{athleteID}/activities.csv
then running them through a classifier to get the activities I want more details for, and I feel grimy calling the GET /api/v1/activity/{id}
endpoint in a loop.
Thanks for considering this idea!
I added: GET /api/v1/athlete/{athleteID}/activities/{id1},{id2},..
which returns a JSON array of activities.
Add ?intervals=true
to include the interval data.
The activities are streamed back one per line so you can parse them one at a time if you like:
[
{"id": "i2132160", "start_date_local": "2021-10-02T08:07:53",..},
{"id": "i2155441", "start_date_local": "2021-10-05T06:53:52",...}]
@david Where would one get the data for
eFTP / FTP and Weight?
I found that I can get eFTP/FTP and Weight from Actual Activities (https://intervals.icu/api/v1/athlete/(athleteId)/activities) endpoint. But for Planned Workouts, These are not populated.
Am I supposed to get these from the wellness endpoint?
Actually, is there an endpoint for getting user preferences? I’m missing things like UserWeight / Power Zones (i’m parsing the workout_doc to get this), Metric vs Imperial units? Things like that?
Thanks…
For eFTP and FTP is probably ok to just use the athlete’s current settings for future workouts. For eFTP use the value from the most recent activity. For weight the most recent from the wellness endpoint should do.
You can do GET /api/v1/athlete/{id}
to get most info about an athlete including settings for different sports.
Is there any shortcuts to get the most recent (updated) value from any of the endpoints? I really dont want to be parsing thru entire months of data to get eg: userWeight or RestingHR
eg: I just tried the wellness endpoint, if I don’t put in an oldest/newest parameter, it will push close to 2 months of data (could be from the day I signed up? not sure) and the (one) day which I put in my fake userWeight is on Oct-1 for eg. (The other days would be “null” which is correct)
I guess this would apply for eFTP as well.
I tested this and seems like I can get the most recent value from the
GET /api/v1/athlete/{id}
endpoint. Could you please confirm if this is true?
I realised that there are multiple FTP and eFTP involved.
There’s Activity FTP
There’s Settings FTP (which also has indoor FTP)
seems like Settings FTP is used to plan for workouts ( There’s also indoor FTP, but doesn’t seem to be used for workouts creation.)
how is activity FTP derived from?
i tested by purposely changing my settings FTP to 200w but activity FTP maintains at 150w
when I look at the weekly summary popup, it seems like it’s using the Activity FTP.
So my question is, to be in sync,
at the start of the week, when there’s NO Actual rides have taken place, where / which FTP is taken for the summary popup?
What is the API call to delete all planned workouts from x date to y date?