cancel
Showing results for 
Search instead for 
Did you mean: 
Announcements

The Hub is now in read-only mode as we make improvements to the Hub experience. More information is available here.

get activity information of Number of currently connected athletes

huynt1337
Shkhara

Hi everybody
Currently, I haven't found a solution to get all registered user's activities, does anyone have any solution?

Hope to receive help from everyone

5 REPLIES 5

huynt1337
Shkhara

Currently, I only receive information for 1 athlete, I want to get information for all

If you mean all users who have authorized your app, you will need to make calls to getLoggedInAthleteActivities with the auth token for each authorized athlete.

If you mean all Strava users, that is not possible. You can only retrieve activities for athletes who have authorized your app.

 

That's right, I only want to get the list of registered people, but the API /athlete/activities can only get the list of each person, how can I get all of it?

Thank you for your help

As I said in my previous reply, you need to make a call to getLoggedInAthleteActivities for each user. One of the parameters to the function call is the access token, so you would need to make the call with the token for each registered user. There is no way to get it all in a single call since all Strava API calls only return data for the user whose access token you are using, and getLoggedInAthleteActivities can return at most 200 results per call.

In pseudocode it looks something like this at a bare minimum

 

all_activities = [] //Empty array
foreach registered user:
  token = get_auth_token(user) //Either from a cache if the token isn't expired, or using oauth + refresh token if it is
  current_page = 0
  do:
    activities = getLoggedInAthleteActivities(page=current_page, per_page=200, access_token=token)
    all_activities.append(activities)
    current_page++
  while (activities.length == 200) //Kind of a hack but it will work. It would be better to also compare the last activity timestamp against the 'after' argument
    

 

 

Jan_Mantau
Superuser
Superuser

Which kind of activities do you miss?