Today I went out for my first run post-Christmas. It was about as much fun as you’d expect but that’s not the point.
When I finish a run, my watch uploads the data to Garmin Connect, which in turn syncs the data with FetchEveryone (for their great analytics) and Strava (for their API). The Strava API is generally more accessible than Garmin’s and I already use it for integrations with Google Calendar, so it dawned on me that my Strava account has years’ worth of data that I can tap into for various personal projects. Then I had to change course to avoid three horses coming down the centre of the trail.
To get the ball rolling post-run I logged onto my Strava account and accessed my profile, only to find no mention of the API anywhere. Some Googling established that the URL needed updating from https://www.strava.com/settings/profile to https://www.strava.com/settings/api to show the My API Application options, which helpfully includes a link to the Strava Developer documentation:
I completed the fields using the recommendations in the documentation and in response Strava provided a set of API credentials:
The next step was to make a cURL request against the Strava API for my profile data, for which the Strava docs suggested Postman – a platform for building and using APIs. I made an account there, created a GET request for https://www.strava.com/api/v3/athlete and set an Authorization key-value pair using my Strava Access Token:
I then received the below response in JSON:
"id": 18701823,
"username": null,
"resource_state": 2,
"firstname": "Damien",
"lastname": "Jones",
"bio": "",
"city": "[REDACTED]",
"state": "England",
"country": "United Kingdom",
"sex": "M",
"premium": false,
"summit": false,
"created_at": "2016-12-02T00:37:23Z",
"updated_at": "2021-12-27T00:05:26Z",
"badge_type_id": 0,
"weight": 0.0,
"profile_medium": "[REDACTED]",
"profile": "[REDACTED]",
"friend": null,
"follower": null
}
Success!
That’s as far as I’m going to take this today but in the coming days I want to take this forward and try out some of the Python examples in the Strava docs.
Thanks for reading! ~~^~~