API access to Intervals.icu

can anybody support me with the API please?

Please refer to the threads above.
But IIRC, CSV upload for planned workouts are not supported
you need JSON/FIT/MRC/ERG/ZWO and the like

i want to upload a whole seasonplan not one workout.

Should be the same process.

i want to upload a season plan for marathon running and triathlon training to the intervals.icu database - so every one can select this plans and get them displayed in his calender with his threshold levels.

I saw you asked this same question last year

so it LOOKS like you’re not really wanting to upload a bunch of workouts, but to upload a series of Planned TSS?

i want to plan a season or a specific event in xls (very easy and fast)
i have all numbers calculated in TSS or in % of threshold or whatever it needs to be compatible

in ideal world i upload this plan (xls, json, txt, csv or webinterface of intervalls icu) in intervalls.icu and everyone can select this plan and gets it in his calender.

if it is easy to upload a plan more people can upload plans and cummunity grows.

i have a lot of plans in my database i can share.

bonus would be a 5 star rating from users who rate each plan so you can sort plans by rating and event (marathon, triathlon, 10k etc …)

i just need small support how to start as I am new in intervals.icu API programming

You need to generate Intervals.icu JSON for your plan and use this endpoint to upload it to an empty plan in your workout library.

https://intervals.icu/api-docs.html#post-/api/v1/athlete/-id-/workouts/bulk

Create a new plan in the UI and use the inspector to find its ID. This is the folder_id for the workouts. In this case it is 321405.

POST /api/v1/athlete/{id}/workouts/bulk
[
  {
    "name": "Test 1",
    "description": "This is fun!\n\n- 60m Z2",
    "folder_id": 321405,
    "type": "Ride",
    "day": 3
  }
]

Intervals.icu will parse the description and create the workout(s). You need to close your library in the UI and re-open to see it. The “day” is a zero based day from the start of the plan.

You can also use the API to create the plan in the first place instead of using the UI etc…

GET /api/v1/athlete/{id}/activities seems to only get activities to the date before newest, at least when no time is specified.

While technically that might be okay, i.e., assuming a time of 00:00 h for “not specified”, it is counterintuitive and setting it to 24:00 h (or 23:59:59 h) might be closer to expectations;-)

Can you please add a “comments” response to the activity data provided on the API.

As I now fully replaced Strava by i.icu, I want to create a logbook of activity notes that can be quickly parsed. The two things I feel are missing right now are these comments and the corresponding attachments.

Retrieving a single or a list of activities through the API always returns

"attachments": null,

Should return the specified info for any attached files from the notes, i.e.

"attachments": [
    {
      "id": "string",
      "filename": "string",
      "mimetype": "string",
      "url": "string"
    }
  ],

I have made newest default to 23:59:59 if it is only a date as you suggested. Tx. Will deploy Thurs AM (GMT+2).

You can get comments for an individual activity from this endpoint:

GET /api/v1/activity/{id}/messages

I might add a bulk endpoint for that.

The attachments field on activity is for activity attachments added on the activity /data page:

1 Like

:+1:t2:

That works, thanks – did not see/find it with the name;-)
Regarding the bulk endpoint, to me it seems natural to have it directly included in the activities from the list-all-activities response, as it seems to not be much data.
Anyway, works for me as it is with 2 more lines, but it does generate many more API calls; no performance problem for me…

Re attachment, I had assumed this already when looking at it again.

Thank you for the useful feedback!

Ah that explains it. I’ve been using oldest = my_date, newest = my_date + 1 to get activities for a single day and was suddenly getting 2 days of activities. Some minor code tweaks tonight for me :slight_smile:

Ah sorry I was worried it would break someone’s stuff. But I had to change it. Several other related endpoints already used 23:59:59 for date-only newest.

2 Likes

Just checking. Have you made. the same change to the events end point?

The GET /api/v1/athlete/{id}/events endpoint already worked correctly i.e. newest without a time is 23:59:59.

1 Like

Thanks - That make sense with some minor oddities I’d been seeing in data as I’d assumed it was the same as activities. All good now :+1: