you could also add a time-driven trigger for the importIntervalsICU function from the script editor instead of a button so it will import at regular intervals without manual intervention
Does this work with google sheets, even when the file is not open? Would be a big advantage over excel, also for other stuff.
Yes, triggers will fire even if you are not logged in to Google
I think that’s useless load to David’s servers
triggering every hour - agreed. But once or twice a day - if that kills the servers then he really does need more Stripe subscribers!
Thats very small compared to processing all the activities that come in every day.
Hello everyone. First of all, this app is great.
According the API I would like to ask if there is an endpoint, which could be used to update weight in the user settings section. This would help me to update weight on every measurement taken. Thank you. M
Tx. You need to use the update wellness data endpoint:
PUT JSON to https://intervals.icu/api/v1/athlete/2049151/wellness/2021-01-24
{
"weight": 71.0
}
The endpoint also takes an optional query parameter ‘localDate’ which is the current date for the user in yyyy-MM-dd format. If this matches the date being updated then the user’s “current” weight and resting HR are updated.
Hi David, one more question please. Do I do anything wrong in getting the last (for specific date) wellness data? I am trying to get mood, stress, fatigue, soreness, motivation yet always get those values NULL.
I use:
GET /api/v1/athlete/2049151/wellness/2021-02-04
Get the response, yet those data are always empty (NULL)
Thank you, M
Did you replace the 2049151 with your own athlete ID? Thats mine and you should get a 401 error.
Yes, I use my ID.
https://intervals.icu/api/v1/athlete/i13124/wellness/2021-02-04
The output
{“hrv”:null,“weight”:93.299999999999997,“restingHR”:50,“sleepSecs”:null,“menstrualPhase”:null,“systolic”:null,“updated”:“2021-02-04T17:26:51.592+0000”,“spO2”:null,“kcalConsumed”:null,“id”:“2021-02-04”,“mood”:null,“motivation”:null,“fatigue”:null,“hydration”:null,“stress”:null,“diastolic”:null,“menstrualPhasePredicted”:null,“hrvSDNN”:null,“sleepQuality”:null,“soreness”:null}
I just had a look at your calendar and you only have weight and resting HR captured for 4th Feb. The 3rd of Feb has sleep, HRV SDNN, SpO2 etc as well. But no mood, fatigue etc…
I see you are using HealthFit. I don’t know if it uploads mood, fatigue etc… Probably not unless there is some corresponding setting in Apple Health.
Oh, I see. I actually thought I would be able to get those data from the system as I see them. If I understand it, they are calculated yet not available, correct?
Ah! The fatigue in the wellness data is a subjective fatigue measure i.e. what did you feel like before training? It’s different to the calculated fatigue on the fitness chart.
You can get the chart numbers here: https://intervals.icu/api/athlete/2049151/activities.csv
That CSV includes lots of stuff including icu_fatigue and icu_fitness as after each activity.
I am going to improve this side of the API soon. I need to add an endpoint that gives you all the fitness info combined with wellness in JSON and/or CSV.
I’m experimenting with the workout endpoints today – as far as I can tell the current workflow for downloading a scheduled workout in an external format is something like:
- GET
/events
for the athlete (say for the next week) - extra the
workout_doc
field from events identified as workouts - POST that same payload back up to
/download-workout.mrc
in order to get back an .mrc file.
Is the expectation for creating a workout similar? IE, POST to /workouts
that same ‘workout_doc’ format? And if so, is there a spec of some sort for that format I could take a look at? (I’m sure I could reverse it, but it doesn’t hurt to ask. )
Thats about right but I shouldn’t have added the download-workout endpoint to the public API just yet. I don’t want the workout_doc to be part of the public API. I need to make a version of that endpoint that accepts the id or the text for a workout instead. But if you pass in a workout_doc you have retrieved it will work.
The workout_doc is the parsed form of the workout text (the steps and whatnot) for a particular athlete (so all the % FTP and so on has been resolved to watts etc.). Currently I only have JavaScript code on the client to do this. I still need to sort this out server side. The server is Java so I need to create a separate little Node service using the same code as on the client to do this.
I am interested to know what you are up to I can speed this up if needed!
What I’m driving toward is:
- load upcoming sufferfest outdoor workouts into intervals so I can track upcoming load/events
- pull scheduled workouts from intervals and transform them into the ‘wahooplan’ format
- load them onto my Wahoo head unit
IOW, reducing some of the pain listed here: Push workout to Wahoo There’s no getting around copy/pasting the foreign workout text and using a USB connection to load onto the Wahoo, but I figure everything should be automate-able.
Given a hand-created intervals workout I can get this done with the approach I outlined above. Fully automating the pipeline via API (as currently exposed) seems like it’ll require me to POST a new workout with workout_doc
already in place, so it can be re-downloaded later as a .mrc
file.
I agree that a more ideal workflow would be to upload the workout either as a standard format via convert-workout
or just in a textual format that can be parsed server-side, then later pull a standard format back down by referencing a workout or event id.
Apologies if it’s already been asked, but is there a way of updating the FTP on an activity using the API? I have no problems exporting the IDs and looping through them (pulling the FTP data from another file based on the date), but I’m not 100% on what to use.
Edit - Tried a couple, but no joy. I thought it would have been the put on “/api/v1/athlete/{id}/events/{eventId}”, but I’m getting a server error. Do I need to send all the fields back?
No there isn’t but I have just added an endpoint, will deploy Sat AM (GMT+2):
PUT /api/v1/activity/{id}
{ icu_ftp: 300 }
Ahh, nice one. Thanks.