Yes, that is working. If you specify the columns you want, it gives you exactly that. If you don’t use the ‘cols’ statement it gives you all the standard Wellness fields but not the custom ones.
I accidentally delete the tabs, when setting up a new athlete’s file, but actually working on my master. Then I forgot how I did it before and ended up with this method to download… would that be considered trial and error?
I have been doing that a lot lately, and I call it ‘learning’
Thanks! That works. Trying to think what was different about the URL I was using. I think it was the date. I had a date in mine.
Great that it’s working for you.
The date in the normal wellness download, in the activities page, has dates in the future. It’s easy to ignore it in Excel, but it’s easier without future dates.
@Gerald
Hmmm
I spoke too soon. Some custom columns import. Others do not.
LFPower and EliteHRV data imports. HFPower does not.
They’re all configured the same way, although I don’t know what ‘format’ .1f means. I just left it as default.
Same result when I add a date to the query (this is preferrable as I don’t want to import rows older than Oct 25th 2019
Are you able to input data in the custom fields?
There seems to be missing fields, Units of Measure, Min and Max values, etc.
Here’s the Sweat Rate field
Once that is working, then I select the fields in the Welllness settings
Tick the health box, as it isn’t showing in the list of fields that will download.
Once ticked, Health then shows in the list, and will show in the URL.
The CSV upload is now fussy about custom wellness column names. If the athlete doesn’t have that wellness field configured it will return a 422 error with a message.
If you want the old behaviour (missing custom wellness fields ignored) then specify ignoreMissingFields=true as a query parameter.
Hi! Are the daily wellness stats files from Garmin downloadable through the API? Thanks!
Shot from the hip: if they end up in the wellness fields, then yes just get the wellness data via the api. Otherwise get whatever endpoint of the api assembles the „position“ of the garmin data you’re looking for (e.g. workouts for hrv for a specific workout synced via garmin)
Yes if you have enabled Garmin wellness integration in /settings and can see the data in Intervals.icu then you can get it from the API.
Would you have a basic example of how to query the API using Python? I just can’t get it to produce results. Been playing around with this, but keep getting “<Response [200]>” as result.
import requests
import json
url = "http://intervals.icu"
api_url = 'https://intervals.icu/api/v1/athlete/yyyyyyy'
api_key = 'xxxxxxxxx'
data = {
"url" : api_url,
"API_KEY": api_key,
"accept": 'application/json, text/plain, */*'
}
Response = requests.get( url, data )
print( Response)
You should check correct field in Response
Try print(Response.content)
You can get information on how to parse response provided by requests.get() at
requests module help
In any case, you could use following code to also encode user/password
import base64
import requests
yourID = 'xxxxxxxxx'
yourAPIKEY = 'xxxxxxxxxxxxxxxxxxxxx'
userpass = 'API_KEY:' + yourAPIKEY
userpass_bytes = userpass.encode('ascii')
base64_bytes = base64.b64encode(userpass_bytes)
base64_userpass = base64_bytes.decode('ascii')
url = 'https://intervals.icu/api/v1/athlete/' + yourID
headers = {
'accept': '*/*',
'Authorization': 'Basic ' + base64_userpass,
}
response = requests.get(url, headers=headers)
print(response.content)
Thank you! This works. Now I can work further from here
Just in case others come across this Python snippet, it can be simplified even more since requests
supports basic auth credentials with the auth
argument. Getting your athlete summary can be done in Python like this:
import requests
intervals_id = 'xxx'
intervals_api_key = 'xxx'
url = 'https://intervals.icu/api/v1/athlete/' + intervals_id
response = requests.get(url, auth=('API_KEY', intervals_api_key))
print(response.json())
Note also the use of .json()
on the response object. Requests gives you this helper which will automatically convert the JSON response into a dictionary for you.
Even better!! Thank you
Hi David/others, I have written a crude script that syncs my intervals.icu weight (coming from Garmin connect) with Wahoo Systm. Now I want to automate it. Is there any webhook or efficient way of only running the script when the weight changes? Or do I have to schedule the script to run every X hours? If I have to schedule it is there preference on number of calls per minute/hour/day etc; I don’t want to unwittingly hammer the intervals api for the occasional daily weight update. Thanks.
There aren’t any webhooks so just running every few hours is the solution. That won’t overly stress the servers. Tx for asking.
If you are still playing with this, you can peruse the source at GitHub - rday/py-intervalsicu (shameless plug). I haven’t been actively keeping this up, but if there is interest in it I would be happy to do so. If not, maybe it would help with basic connections to the API.