What if we need more than 600 request per 15 minutes, and how to calculate month stats

2,135 views
Skip to first unread message

Agnes Vanessa Alvarez Torres

unread,
Nov 27, 2014, 11:04:57 AM11/27/14
to strav...@googlegroups.com
Hi all!

I have the following 2 questions:

- Currently we do not know how many users we will handle, so what happens if we need more than 600 request every 15 minutes or more than 30000 per day? Does it have a cost? if yes How much is it?, also How long does that approval process take?
- In your API agreement, in the retention section you say "No data shall remain in your cache longer than seven days", that let us for instance calculate the user's mileage per week but not per month, so how can we calculate user's stats per month? we would like to know if the user accomplishes X miles per month.


Thanks in advanced,

 



Martin T

unread,
Nov 27, 2014, 8:48:48 PM11/27/14
to strav...@googlegroups.com
Agnes - The cache restriction is on keeping API Call results, not on retaining derived data within your app.

So for example, your app might keep the Month to date figures in a local data store and periodically update this data.

That would allow you to reduce the number of API calls you make - You don't want to completely recalculate a users data every time they request to view their statistics!

Paul Mach

unread,
Dec 1, 2014, 3:27:44 PM12/1/14
to Martin T, strava-api
If you're in need of a rate limit increase please email developers at strava.com with your client id. We'll take a look at how you're using the API and act accordingly.

As for caching. There are two important points. If a user disconnects from your service you must delete all of their data. The 7 day limit is to ensure the data is up to date. So, if you're displaying monthly summaries, just make sure they're up to date. 

Dr. Paul Mach
STRAVA

--
You received this message because you are subscribed to the Google Groups "Strava API" group.
To unsubscribe from this group and stop receiving emails from it, send an email to strava-api+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Agnes Vanessa Alvarez Torres

unread,
Dec 1, 2014, 4:30:52 PM12/1/14
to strav...@googlegroups.com
Thanks a lot that is really helpful!

I just have one more question, what about the service to get athlete's activities, is it returning the whole history, or for instance just the last 200 activities, or the history of one year?

Paul Mach

unread,
Dec 1, 2014, 4:52:15 PM12/1/14
to Agnes Vanessa Alvarez Torres, strava-api
The "List athlete activities" endpoint supports pagination with a max per_page of 200. http://strava.github.io/api/v3/activities/#get-activities

Dr. Paul Mach
STRAVA

Agnes Vanessa Alvarez Torres

unread,
Dec 1, 2014, 6:04:47 PM12/1/14
to strav...@googlegroups.com
And assuming I am using pagination to get those user's activities, Is it capable to return the whole activity history for that user? no matter how many activities does he/she have?



On Thursday, November 27, 2014 10:04:57 AM UTC-6, Agnes Vanessa Alvarez Torres wrote:

Paul Mach

unread,
Dec 1, 2014, 6:33:48 PM12/1/14
to Agnes Vanessa Alvarez Torres, strava-api
It is limited to 200 activities per api call.

Dr. Paul Mach
STRAVA

Agnes Vanessa Alvarez Torres

unread,
Apr 1, 2015, 8:05:08 PM4/1/15
to strav...@googlegroups.com, agnes...@gmail.com
I am checking the api requests, looks like the request access call is not counting as an api call, so if my app have a rate limit of 600 requests per 15 minutes and 700 users connect with strava in my website in the first 15 minutes, I have nothing to worry about because my amount of api requests will be 0.
Can you confirm that?

Thanks in advanced,

Paul Mach

unread,
Apr 1, 2015, 8:20:44 PM4/1/15
to Agnes Vanessa Alvarez Torres, strava-api
What app are you working on where you expect 600 people to connect in 15 minutes?

Yes, calls to https://www.strava.com/oauth/... do not count towards the rate limit. But every call to https://www.strava.com/api/v3/... does.

Dr. Paul Mach
STRAVA

Blind Hydra

unread,
Apr 20, 2023, 12:59:23 PM4/20/23
to Strava API
Hello there, I don't know from where you are using the Strava API, but I use python and built this function in order to avoid the 100 pings per 15 minutes. Of course you will still have to wait to get all your data but thought this solution was better than waiting to get access. You can probably refractor this code and built something similar!


def GetAllWorkouts(workout_list, access_token):
    workout_info = []
    workout_num = 1
    rate_limit = 100
    time_interval = 900  # 15 minutes = 900 seconds
    wait_time = ((len(workout_list)/100) * 900)/60

    print(f'Extracting all workouts, due to the API rate limit, this will take {wait_time} minutes to run.')
    for i in workout_list:
        print('Extracting workout:', workout_num)
        req = requests.get(url=f'https://www.strava.com/api/v3/activities/{i}?access_token='+access_token)
        if req.status_code == 200:
            req = req.json()
            workout_info.append(req)
            workout_num += 1
        elif req.status_code == 429 and 'message' in req.json() and req.json()['message'] == 'Rate Limit Exceeded':
            # If rate limit exceeded error is received, wait for 15 minutes before continuing
            print('Rate limit exceeded. Waiting for 15 minutes...')
            time.sleep(time_interval)
        else:
            print('Error occurred during API request:', req.status_code, req.json())
            break

        # Pause after every 100 iterations and wait for 15 minutes
        if workout_num % rate_limit == 0:
            print(f'Reached rate limit of {rate_limit} requests. Sleeping for {int(time_interval/60)} minutes.')
            time.sleep(time_interval)

    return workout_info

Reply all
Reply to author
Forward
0 new messages