fawda123 / rStrava

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

Errors get_segment #60

Closed susay closed 5 years ago

susay commented 5 years ago

Hello, I would like to read all data of a segment and wanted to use get_segment. The parameter 'request' can have 4 values according to the documentation but only "all_efforts" and "leaderboard" works for me.

I get the following errors with the other values:

request = 'starred' Error in strsplit(req$headers$x-ratelimit-limit, ",") : non-character argument

request = 'explore' Error in get_basic(url_segment(id, request = request), stoken) : Bad Request (HTTP 400).

My Segment ID was "19974046"

fawda123 commented 5 years ago

Sorry for the delay on this. I updated the documentation for get_segment to make the usage more clear. All should work now, except request = 'explore', which was removed.

From the updated help file:

 The authenticated user must have an entry for a segment to return all efforts if \code{request = "all_efforts"}. For \code{request = "starred"}, set \code{id = NULL}.

From the help file examples:

# get segment info
get_segment(stoken, id = 229781)

# get top ten leaderboard for the segment
get_segment(stoken, id = 229781, request = "leaderboard")

# get all efforts for the authenticated user on the segment
get_segment(stoken, id = 4483903, request = 'all_efforts')

# get the starred segments for the user
get_segment(stoken, request = 'starred')