You get a paginated response. Did you try adding the `page` and/or `per_page` request parameters?
@chwunder Obviously you have discovered that the per_page parameter has a maximum of 200 and the page parameter just doesn't work (at least it didn't in the last few years). We're all using the "before" and "after" parameter to get the next batches of activities. In example you get the newest 200 activities first, then the 200 activities with an "before"-Timestamp older than the oldest of the first 200 actitivities and so on.
@Jan_Mantau The page parameter works perfectly ATM (at least for the /activities endpoint), so there is no need to add complexity with the timestamp arithmetic
@jsamoocha Thanks, good to know!
@jsamoochado you happen to have some url examples?
I'm currently trying to get all activities, and regardless of what I set in the page, per_page, after and before query parameters I get the same 30 activities over and over again (i have 500+ in total)
Both the queries below returns the same list of 30 activities:
Page 1 : https://www.strava.com/api/v3/athlete/activities?access_token=<token>&after=0&before=1673470644 (today)
Page 2 : https://www.strava.com/api/v3/athlete/activities?access_token=<token>&after=0&before=1659793661 (aug. 6 2022 - oldest returned in the first query)
Hi,
I don't see any `page` or `per_page` parameters in your examples. The following should work (I just checked again on my end):
https://www.strava.com/api/v3/athlete/activities/?per_page=200&page=1
You can also add before/after parameters.
UPDATE: I made it work by omitting the per_page parameter. It now works with just the page parameter and auth header.
weird..
-----
Hi,
Thanks for you reply.
I realize that my examples above wasn't as described, sorry for that, but I did try the page and per_page parameter.
A little bit more experimenting has revealed that I can only get activities if I provide the access token as the first (!) query parameter - named access_token. And in that case, any combination of page, per_page,after and before results in the same 30 activities - regardless of the numbers i write in page and per_page.
Auth. error on:
curl https://www.strava.com/api/v3/athlete/activities?per_page=10&page=1 -H 'accept: application/json' -H 'Authorization: Bearer <token>'
curl https://www.strava.com/api/v3/athlete/activities?per_page=10&page=1&access_token=<token> -H 'accept: application/json' -H 'Authorization: Bearer <token>'
Auth ok, but always same 30 activities (the latest):
curl https://www.strava.com/api/v3/athlete/activities?access_token=<token>?per_page=10&page=1
After fetching the 30 activities, I read streams for each activity using auth header, which works just fine.
Any ideas?
I agree that this can be useful, but just to mention that the current activities limitation is only for the Mobile version.
Hey chowunder,
Thanks for posting, if you are using this endpoint the response is paginated and there are 30 results per page. You should see the # of results in the per_page section in the docs for that endpoint.
I've just been trying this with segment_efforts, but have the issue that it is not returning the efforts ordered by date. Any advice?
First option would be not using this endpoint because you can get the segment efforts per activity or per segment too.
Second option is to make the start start_date_local and end_date_local so narrow that you definitely get all the segment efforts in there. It would be some strain on your limits though.