I can not figure out how to get a list of Segments that an athlete has ridden. I can get the list of Activities in a given time period using the below. But, how do I then see if those Activities contain a certain segment? I can't figure out where/how to link an activity to a segment or link a segment to an activity or just search for a segment across an athlete's activities within a start/end date.
The goal is that I want to see if an athlete has ever ridden a segment within a specified start/end date. So, " Did Bobby ride Segment A between StartDate and EndDate".
Any guidance is greatly appreciated,
Getting the athletes segment efforts for a segment is explained here: https://developers.strava.com/docs/reference/#api-SegmentEfforts-getEffortsBySegmentId
The endpoint that gives you a list of segments for an activity is documented here: https://developers.strava.com/docs/reference/#api-Activities-getActivityById
Those are rather easy to find though. What was the problem?
Thank you Jan,
I have figured these out. My "issue" is that 1) I don't know the segmentID unless I first get the Activity. I can't get the Activity if I don't know the ActivityID UNLESS I first get ALL Activities using "/athlete/activities" first and then iterating across each Activity looking for a specific segment ID. Unless I am missing something.
Here is the "question" that I was hoping there was an API call that would answer. Did an athlete complete a segment before and after a start/end date. In other words, provide a segment ID, start date, end date and if there is a segment effort for that athlete between those dates, return success or failure. Think of a situation where I would like to know all the segments that an athlete has completed.
If you're interested in a specific segment then you can find the segment id at the end of the URL in the segment page like in https://www.strava.com/segments/29836946
After that you can use the mentioned https://developers.strava.com/docs/reference/#api-SegmentEfforts-getEffortsBySegmentId where you can provide exactly the parameters you wanted. But if you want to see all the segment efforts for any segment an athlete ever has made then you need the procedure you've described with activity summary and detail activities.
Ok. so maybe I have the approach necessary. I first have to get a list of all activities within the timeframe I am interested. Then, using the returned ActivityIds for each of those, I then have to get the detailed activity usinghttps://www.strava.com/api/v3/activities/ that returns all of the segment efforts. Then I can interrogate those for specifics segementIDs. Is this correct? Is there a more straightforward way? I wish there was an API that just searched for Athlete Completed Segments within a TimeFrame. Thanks much.