fawda123 / rStrava

Functions to access data from Strava's v3 API.
152 stars 31 forks source link

get_leaderboard() Forbidden (HTTP 403). #84

Closed Howquez closed 3 years ago

Howquez commented 3 years ago

Hi!

I just tried to retrieve the leaderboard of a segment using rStrava::get_leaderboard(stoken, id = 27769116), which returned a 403 status code even though the stoken works for other functions. I was facing the same problem with rStrava::get_KOMs(27769116, stoken).

I was wondering whether the token's scope was wrong so I tried read as well as activity:read_all -- but that did not help. I am a subscriber, so I should be allowed to retrieve these information, right?

Thank you for your help and time!

fawda123 commented 3 years ago

Hi @Howquez sorry for the late reply. Those functions are very old and the URL requests may have changed. I dug into the API references a bit and tried a different URL. Have you tried this?

get_pages('https://www.strava.com/api/v3/segment_efforts?segment_id=27769116', stoken, per_page = 10, All = F)

I just tried it on a segment I routinely run and got a different error saying Payment Required (HTTP 402) , which makes me think 1) I need to change the URL, and 2) you need to have a paid plan to view this information. If you have a paid plan, can you verify?

Howquez commented 3 years ago

Thanks you @fawda123,

The command you provided returned an empty list. Changing the segment ID to an ID of a segment I rode recently, it returned a list of (10) efforts. Unfortunately, it only shows the efforts related to my athlete ID (just like get_efforts_list()) instead of the leaderboard.

This release note suggests that leaderboards are a thing of the past, right?

Best Hauke

fawda123 commented 3 years ago

Perhaps, I do remember being able to get this at one point, then they changed it to only personal efforts. This is maybe related to #81.

I gotta say that release note is a little confusing. It says "Segment Leaderboard endpoint is not available" then "Segment Effort & Leaderboard data" are only available to paid subscribers. Not sure how those statements differ.

fawda123 commented 3 years ago

Also, I just changed the URL for the get_leaderboards function to the one in my comment above.

Howquez commented 3 years ago

Perhaps, I do remember being able to get this at one point, then they changed it to only personal efforts. This is maybe related to #81.

Indeed. Too bad I haven't realized that this question originates in the same use case that I have in mind. And even worse that it seems as if there was no quick fix.

I gotta say that release note is a little confusing. It says "Segment Leaderboard endpoint is not available" then "Segment Effort & Leaderboard data" are only available to paid subscribers. Not sure how those statements differ.

They also state that "Individual segment efforts, segment efforts within activities, personal achievements (PRs) and top 10 leaderboard rankings are still available regardless of subscription status." so I am wondering whether one can only query one's own rank if one achieved a top 10 rank or the "whole" n_leaders=10 leaderboard.

fawda123 commented 3 years ago

@Howquez based on what I've seen, I believe it's only possible to query your own rankings.

Howquez commented 3 years ago

Thank you for looking into it!