Google Drive API: Queries per x seconds per user - google-api

The Google Drive API has a quota called Queries per 100 seconds *per user* - but what exactly is a user?
Is it per OAuth 2.0 client ID, or is it per source IP?

As what stated in the note:
Note: Per-user quotas are always enforced by the Drive API. If the
quotaUser and userIp parameters are omitted, the quota user is
determined by the access token in the request.

In general when we refer to the user, it is the "end user". So in the drive API it would be the user who has given access to your app. But the same user could have given drive access to 500 other apps. If all of those apps try to access the user's drive a the same time then this limit could be reached easily and each of the app developer may wonder what they did wrong as they may be just doing 1 qps. So this relates to the user's drive account.

Related

Youtube Data API v3 quota usage application level

I want to create an app for uploading videos to youtube. So I used youtube data API. And I will serve a service for my users to uploading video youtube.
And Official documents says that:
https://developers.google.com/youtube/v3/getting-started?hl=tr#calculating-quota-usage
Google calculates your quota usage by assigning a cost to each
request. Different types of operations have different quota costs. For
example:
A read operation that retrieves a list of resources -- channels,
videos, playlists -- usually costs 1 unit. A write operation that
creates, updates, or deletes a resource usually has costs 50 units. A
search request costs 100 units. A video upload costs 1600 units. The
Quota costs for API requests table shows the quota cost of each API
method. With these rules in mind, you can estimate the number of
requests that your application could send per day without exceeding
your quota.
Is this quotas for a application level or user level. If it is for application level, In this way I have 6 video upload credit from youtube?
What is the clear explanation for this case? Is there any difference about app level quota between user level quota?
The quota is accounted per Google project. That is that each Google project has allocated an amount of daily quota (by default 10000 units) and each API call (being it through an API key or through an access token obtained upon completing successfully an OAuth 2.0 authentication/authorization flow) is deducted out of that quota amount.
Thus, by means of a given Google project, one given application -- if granted permission by several users to access their YouTube channel upon the successful completions of OAuth 2.0 authentication/authorization flows -- could well upload videos to multiple channels.
But, as you noted, in case of one having allocated an amount of 10000 units of quota to his/her Google project, the number of videos that may be uploaded on any given day cannot exceed six (if not counting the other API calls the application may issue).
Of course there's the possibility to apply for quota extensions (by filling in this form); but be aware of the fact that, according to the experience of the users of this forum, the answer from Google does not arrive shortly.
These are application level quotas. When your application runs and you authorize a user the user uploads a video to their account.
If we look at the quota for my system
My application itself has a quota limit of 10000. but each user can max use 180,000 quota. Which is useless as my application itself can only do 10000.
My application itself can use 1,800,000 per minute but again its useless as the total for the application is 10,000.
Intro to YouTube API and cost based quota for beginners 2021.

Google Calendar API - 403 User Rate Limit Exceeded

We have a (verified) application integration with Google Calendar API.
For most of our users, it works perfectly fine. However, we have one particular user account that attempts to synchronize our application's calendar with their Google Calendar. The sync fails with the following message sent back to us via our Google libraries:
Could not sync events to Google Calendar:\nError calling POST https://www.googleapis.com/calendar/v3/calendars/REMOVED/events: (403) Rate Limit Exceeded
This corresponds to the documentation on usage limits.
We have already raised the per-user quota in the development console twice, and neither time did Google's developer console indicate our users were approaching anywhere near to the number of requests that would have led to an issue; we have bumped it significantly anyway.
The other suggestion on this page is the following:
If one user is making a lot of requests on behalf of many users of a G Suite domain, consider a Service Account with authority delegation (setting the quotaUser parameter).
Most of users likely do not have a GSuite domain, so this option is off the table.
Are there any other suggestions for how to handle this situation? Is there anything we can look at to resolve this issue for this user? Would using backoff necessarily resolve this situation? We are uncertain if this user's limit is only for their Google Calendar integration with our software, or if it's possible it relates to other Google services the user might utilizing (in which case backoff on our end would not make a difference). How can we determine the best course of action on this issue?

Can Google Calendar API be used to create scalable scheduling service?

I need to create a scheduler for my own SaaS, and I'm trying to understand whether Google Calendar API is a fit for that. Basically I could have hundreds of thousands of calendars. Each calendar may be a user of my service, but not a Google user. It seems that perhaps I could use resource calendars under my Google Cloud service account. My biggest concern is whether my usage will fall within the Calendar API's service quotas, either automatically or by requesting a quota increase?
Yes service accounts will fall within quota usage limits. There is also a limit about creating more then 25 calendars in a day causing the user to end up in read mode for the rest of the day.
pricing
Google Calendar API Usage Limits
The Google Calendar API has a courtesy limit of 1,000,000 queries per day.
To view or change usage limits for your project, or to request an increase to your quota, do the following:
If you don't already have a billing account for your project, then create one.
Visit the Enabled APIs page of the API library in the API Console, and select an API from the list.
To view and change quota-related settings, select Quotas. To view usage statistics, select Usage.
On the one hand, you could work around the quota issues by sharding your users across multiple Service Accounts. You would probably also want to shard them across multiple App IDs.
On the other hand, don't do it. In my experience, using Google APIs outside their intended use case doesn't end well.

Google Drive - Simultaneous Downloads

I have direct download links (urls) of about 200 files in my google drive.
How many people can download any of these files at the same time.
Is there a limit on simultaneous access by other users to my Google Drive file urls for read only access.
Thanks,
Gagan
There is no limit to the number of people who can access a file at the same time. Read access has no effect on this.
There is a Quota Limit to how fast the application doing the download can run and how much it can access at the same time.
To view your allowed quota please create a project in the Google APIs Console. In the "Service" tab, the default quota allowed for each service is indicated.
Currently for the Drive API it reads "Courtesy limit: 1,000,000,000 queries/day". It's a per app quota.
After you've enabled the Drive API you can also set a per user rate limit (by default 1000 req per 100 sec) to prevent one user from depleting your app's quota. That's available in the "Quotas" tab.

Are service accounts considered as users in Google Sheets API v4 usage limits?

According to the Google Sheets documentation there are Usage Limits applicable:
500 requests per 100 seconds per project
100 requests per 100 second per user
Limits for reads and writes are tracked separately
I want to access a spreadsheet from an App Engine app using the Sheets API, but I wonder how the usage limits are applied to service-accounts.
In Cloud Console IAM of the corresponding project, a service-account is created for the app.
The Google spreadsheet is shared with the email address of the service-account (with edit permission).
Code in the app uses service-account from JSON file to authenticate successfully to the Sheets API. No user delegation included.
App can successfully write to the spreadsheet with the service-account credentials.
Since these requests are done only with service-account credentials and with no user credentials, I wonder if a service-account in this context is considered as a "user" or just as the project (of the app).
Question:
Is the per user limit applicable, i.e. app would be limited to 100 write requests per 100 seconds. Or are these requests only counted against the per project limit, i.e. app could issue up to 500 write requests per 100 seconds?
A service account is a user it has its own Google drive account actually. You shared the sheet with its email address like you would with any other user.
Using a service account is exactly like running as a normal user account the same quota limitations apply.
There is a parameter called quota user which can be used to extend the quote but it doesn't work perfectly from behind the same ip address

Resources