The Hub is now in read-only mode as we make improvements to the Hub experience. More information is available here.
02-12-2024 11:44 PM
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
02-13-2024 07:04 AM
Currently, I only receive information for 1 athlete, I want to get information for all
02-13-2024 08:37 AM
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.
02-13-2024 07:48 PM
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
02-13-2024 10:14 PM - edited 02-13-2024 10:15 PM
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
02-13-2024 02:59 AM
Which kind of activities do you miss?
Welcome to the Community - here is your guide to help you get started!