unable to get activity to return all segment efforts

422 views
Skip to first unread message

Kyle Yost

unread,
Jun 30, 2017, 1:44:54 PM6/30/17
to Strava API
I have a cycling event where we are using strava to augment our chip-based timing.  We have 7 chip timed climbs for the individual KOM competition, but additionally have team competition that uses these seven chip times plus another 5 strava timed climbs.

Thus, I have a few hundred public strava activities, each of which include the 5 segments I am interested in.

However, when my script retrieves an activity and uses parameter "include_all_efforts=true" I do not get the segment_efforts array in the result as expected, per http://strava.github.io/api/v3/activities/

So, how do I get all the segment efforts so I can pull out the climb time?

    -H "Authorization: Bearer [abcd1234]" \
    -d include_all_efforts=true

returns high level activity information, but no segment efforts array.

Help!

Hobson

unread,
Jun 30, 2017, 2:35:29 PM6/30/17
to Strava API
Documentation states what follows:

Activity details, including segment efforts, splits and best efforts, are only available to the owner of the activity.


You have to query for each activity using its owner's authorization token. Using one token "[abcd1234]" when retrieving all these activities won't work, as it will return only public information (and no segment efforts).
You need to ask your athletes to authorize your application, and only then you can use their individual tokens to retrieve activities owned by them.

Regards,
    Maciek

Kyle Yost

unread,
Jun 30, 2017, 3:06:56 PM6/30/17
to Strava API
Wow, that is a whole tremendous lot of suck.

I guess only Mechanical Turk is going to solve this then.

These are public activities.  Anyone with a browser and a finger can view this info.  I cannot for the life of me understand why publicly accessible data would be restricted from access via the API.

I also would have expected this to be a relatively common use scenario.  Allow an event promotor use strava and its power of segments to time events.  I cannot possibly be the first to attempt such functionality.

Oh well, time to pay the internet for manual, robot work.  Mechanical turk, here we come!

Ben Lowe

unread,
Jul 1, 2017, 3:09:13 AM7/1/17
to Strava API
Hi Kyle
I've done these types of leaderboards for events before and the easier way to do it is to get the segment efforts (http://strava.github.io/api/v3/segments/#efforts) for the date of the event and then filter on the athlete_ids for your registered riders (although if you just have the activity ids then you could probably filter on those).
I hope that helps.
Ben
Reply all
Reply to author
Forward
0 new messages