Skip to main content
Answered

Export activities .tcx files using the api


Forum|alt.badge.img+1

Hello,

 

The Strava website provides a convenient way to get the .tcx files of a specific activity:

https://support.strava.com/hc/en-us/articles/216918437-Exporting-your-Data-and-Bulk-Export#h_01GDP2C5E3278KM8MPK5X49ED3

This is a little-known trick, however, it's simple to use.  Simply add "/export_tcx" - without quotes - to the end of your activity page URL. For example, if your activity page is www.strava.com/activities/2865391236 - just add the text to give you  www.strava.com/activities/2865391236/export_tcx and hit enter. This will download a TCX version of your file to the location specified by your browser's preferences

 

Is there a way to achieve this with the API? I can get .tcx file for routes but not for activities.

Thanks for your help!

Best answer by ActivityFix

Directly, there is no API call that I know of.

Indirectly, you could use getActivityStreams to retrieve the various streams for the file you care about and then create your own tcx file. I haven’t searched but I expect there are libraries around for most major programming languages to make creating the file easier.

TCX schema: https://www8.garmin.com/xmlschemas/TrainingCenterDatabasev2.xsd

View original

4 replies

ActivityFix
Forum|alt.badge.img+23

Directly, there is no API call that I know of.

Indirectly, you could use getActivityStreams to retrieve the various streams for the file you care about and then create your own tcx file. I haven’t searched but I expect there are libraries around for most major programming languages to make creating the file easier.

TCX schema: https://www8.garmin.com/xmlschemas/TrainingCenterDatabasev2.xsd


Forum|alt.badge.img+1

Directly, there is no API call that I know of.

Indirectly, you could use getActivityStreams to retrieve the various streams for the file you care about and then create your own tcx file. I haven’t searched but I expect there are libraries around for most major programming languages to make creating the file easier.

TCX schema: https://www8.garmin.com/xmlschemas/TrainingCenterDatabasev2.xsd

Hello ActivityFix and thank you for you answer!

In my mid getActivityStreams was corresponding to a currently happening activity. Is it also available for past activities?

Thank you!


ActivityFix
Forum|alt.badge.img+23

All API calls to retrieve activity data are on past activities. You don't have an activity ID until the activity is saved.


Forum|alt.badge.img+1

Ok, thank you, I’ll look into streams. It should be the right solution for me as I’m more trying to get detailed info of activity than getting a .tcx file. I thought tcx would give me the info I need, but streams is may be a better option.

Thanks!