Strava API is_kom

263 Views Asked by At

I would like to find out if I am the KOM on a specific segment. According to the API this should be possible using: "https://www.strava.com/api/v3/segments/{id}"

This should return a DetailedSegment. However, the athlete_pr_effort data is not contained in the response.

When iterating over starred segments, you also get a DetailedSegment instance and the athlete_pr_effort is set like expected. In my case, the segment is not starred though.

Any idea how this can be done?

2

There are 2 best solutions below

5
David Spence On

The Strava Segment Leaderboard endpoint was deprecated. It used to exist here:

https://www.strava.com/api/v3/segments/:id/leaderboard

Strava's update mid 2020: https://developers.strava.com/docs/segment-changes/

It also states that you need to be a subscriber to get the kom_rank field (which I think is what you're looking for).

/api/v3/segments/:id/leaderboard Segment Effort & Leaderboard data, included fields such as kom_rank, are only available for subscribers in the following endpoints.

/api/v3/segments/:id /api/v3/segment_efforts [Updated] /api/v3/segment_efforts/:id/streams /api/v3/activities/:id

0
user10408 On