google-api,google-drive-sdk,quota , Raised Gogle Drive API Per-user limit, still getting userRateLimitExceeded errors

Raised Gogle Drive API Per-user limit, still getting userRateLimitExceeded errors


Tag: google-api,google-drive-sdk,quota

Similar to Raising Google Drive API per-user limit does not prevent rate limit exceptions

In Drive API Console, quotas looks like this:

enter image description here

Despite Per-user limit being set to an unnecessarily high requests/sec, I am still getting rate errors at the user-level.

What I'm doing:

I am using approx 8 threads uploading to Drive, and they are ALL implementing a robust exponential back-off of 1, 2, 4, 8, 16, 32, 64 sec back-off respectively (pretty excessive back-off, but necessary imo). The problem can still persists through all of this back-off in some of the threads.

Is there some other rate that is not being advertised / cannot be set?

I'm nowhere near the requests/sec, and still have 99.53% total quota. Why am I still getting userRateLimitExceeded errors?


userRateLimitExceeded is flood protection basically. Its used to prevent people from sending to many requests to fast.

Indicates that the user rate limit has been exceeded. The maximum rate limit is 10 qps per IP address. The default value set in Google Developers Console is 1 qps per IP address. You can increase this limit in the Google Developers Console to a maximum of 10 qps.

You need to slow your code down, by implementing Exponential Backoff.

  1. Make a request to the API
  2. Receive an error response that has a retry-able error code
  3. Wait 1s + random_number_milliseconds seconds
  4. Retry request
  5. Receive an error response that has a retry-able error code
  6. Wait 2s + random_number_milliseconds seconds
  7. Retry request
  8. Receive an error response that has a retry-able error code
  9. Wait 4s + random_number_milliseconds seconds
  10. Retry request
  11. Receive an error response that has a retry-able error code
  12. Wait 8s + random_number_milliseconds seconds
  13. Retry request
  14. Receive an error response that has a retry-able error code
  15. Wait 16s + random_number_milliseconds seconds
  16. Retry request
  17. If you still get an error, stop and log the error.

The idea is that every time you see that error you wait a few seconds then try and send it again. If you get the error again you wait a little longer.

Quota user:

Now I am not sure how your application works but, If all the quests are coming from the same IP this could cause your issue. As you can see by the Quota you get 10 requests per second / per user. How does Google know its a user? They look at the IP address. If all your reuqests are coming from the same IP then its one user and you are locked to 10 requests per second.

You can get around this by adding QuotaUser to your request.

quotaUser - Alternative to userIp. Link

  1. Lets you enforce per-user quotas from a server-side application even in cases when the user's IP address is unknown. This can occur, for example, with applications that run cron jobs on App Engine on a user's behalf.
  2. You can choose any arbitrary string that uniquely identifies a user, but it is limited to 40 characters.
  3. Overrides userIp if both are provided.
  4. Learn more about capping usage.

If you send a different quotauser on every reqest, say a random number, then Google thinks its a different user and will assume that its only one request in the 10 seconds. Its a little trick to get around the ip limitation when running server applications that request everything from the same IP.


Google Drive API: I have to fetch only files in that folder without trashed files

I am trying to get a list of files in a folder on Google drive using the Google drive API. When I make my request I am getting a list of child elements in that folder including previous deleted files. How do I get only the files that are in...

Google Analytics Embed API: Display specific account data, not authenticated users

I have this example - Embed API Third Party Visualizations - working locally and on a test server, but I'm unsure of what I need to do to ONLY display our organization's Google Analytics data instead of the user's personal GA account. I created the project and clientID within our...

Google Logging API - What service name to use when writing entries from non-Google application?

I am trying to use Google Cloud Logging API to write log entries from a web application I'm developing (happens to be .net). To do this, I must use the logging.projects.logs.entries.write request. This request dictates that I provide a serviceName argument: { "entries": [ { "textPayload": "test", "metadata": { "serviceName":...

How to access gmail API?

I generate my JWT, if my token is correct why dont work ? in Google Developers Console i enabled gmail plus youtube and other API, in credentials generate and download json { "private_key_id": "22dcf", "private_key": "-----BEGIN PRIVATE KEY-----(remove)-----END PRIVATE KEY-----\n", "client_email": "[email protected]", "client_id": "", "type": "service_account" } first generate token...

How to by pass authentication in google analytics script?

I would like to display a Google Analytics report in my web application. So far I have successfully Authenticated a user through OAuth with server side and I have successfully stored AccessToken and UserProfileId in my database Table. Now I want to display Chart like Below: Here is the script...

Annotation chart google function after rangechange

I'm using the annotation chart and the map from google api, I would like to know if there's anyway to trigger a function after the range change when the user's clic releases. I just find this, 'rangechange', feed_with_chartMap); in the documentation but the function is not only called when...

Google Cloud Datastore PropertyFilter Error

I'm using the google apis php sdk and trying to access some data from my google cloud datastore. I'm authenticating no problem at this point, but am getting an error during my query. I pretty much look through the code in the sdk to implement it, since documentation is null,...

Google Scripts + Google API PHP

I am trying to call one of my Google Scripts from my google-api-php-client and I can't find how to do this. I deployed my app as a web app, and I got the web app url which I can call with curl, but I need to call it as my...

Access spreadsheet via Google API invalid_grant

I have created a google form, and keeping the form result in an excell sheet named yht_istekler. I am using following code snippet. taken from Create Spreadsheet using Google Spreadsheet API in Google drive in Java Though I am getting following error, what am I doing wrong? List<TrenSeferScheduleEvent> trenSeferScheduleEventList =...

Value cannot be null. Parameter name: baseUri

I am using Google BigQuery API with Service Account Authorization in C# console application. When i am trying to load CSV job, it throws "Value cannot be null. Parameter name: baseUri" Exception. It specific on only single table, when i am changing the table name it all gets work. Here...

401 Unauthorized - Google Drive API,.net,,google-drive-sdk
I'm working with the Google APIs for the first time and I'm having problems trying to download files with the File object "downloadUrl" property. I'm currently using the "Service Account" option with the associated service account email and P12 certificate. However, the URL returned "" returns a 401 - Unauthorized...

Making an iOS authorised Google API call

I have integrated Google Sign-in into my iOS app and retrieved the access tokens after signing in. I am now wanting to make authorised API calls to Google, but am unsure how to do this to include the token. Can someone please share some code that I can use to...

Directory sandboxed access for Google Drive / Dropbox API / RemoteStorage apps?

Is there a way to get sandboxed, user-selected directory access on any major file service without first getting read level access to their entire filesystem? There's a lot of talk about "unhosted" static webapps that allow users to access their data from a 3rd party file service (Google Drive, Dropbox,...

Why this google font is not working?

Have this line on my label and is working properly on a Debian server under Apache, but when I uploaded it to my production server (Debian with Apache too) i cannot get the Open Sans Condensed font. <link href=',300,300italic' rel='stylesheet' type='text/css'> Here's the entire : <head> <meta charset="UTF-8" /> <meta...

Gmail API: Insufficient Permission

THE SITUATION: I am testing the Gmail API for my app. I have tested some requests and they are working fine. For example get messages, get user history, get draft list etc.. Basically all the read only requests are working fine. I have instead some issues related with permission with...

Google Translate API text-to-speech: http requests forbidden

I am making a language learning web app that when you hover over the word, it pronounces it for you. I'd like to access the native speaker translations from Google Translate API. I've found this resource which gives as the base URL and tl for target language and q...

Google Calendar: How to check guest is not busy and available to book through google calendar

I am exploring to write google calendar api integration through google scripts or apis. Is there a way I can check a guest is available before I book an event ?...

unable to add callback: cannot be converted to ConnectionCallbacks

I am trying to add call back to my googleApiClient with addConnectionCallbacks mPlusClient = new GoogleApiClient.Builder(this).addConnectionCallbacks(this).addOnConnectionFailedListener(this).addApi(Plus.API).addScope(Plus.SCOPE_PLUS_LOGIN).build(); but i am getting this error: Error:(85, 81) error: incompatible types: PlusBaseActivity cannot be converted to ConnectionCallbacks I am gotten this code from an online tutorial but it doesnt seems to work, please help....

Failed sending mail through google api with javascript

I'm trying to send an email through Google API with JavaScript. My issue is that when I try to send a simple mail with no attachments, I get the following error: 'raw' RFC822 payload message string or uploading message via /upload/* URL required` My code function sendMessage() { gapi.client.load('gmail', 'v1',...

Hide referrer header in API request

I need to make requests to Google Translate Text-To-Speech API. I have an enabled key but keep getting blocked by No Access-Control-Allow-Origin. I've posted more about it here: Google Translate API - No Access Control Origin with Text to Speech The following sources, and Request to Google Text-To-Speech API...

I want to upload video on youtube using client side login. without open web page permission

When I upload video to YouTube using client side login. The first time redirect to UI for permissions. I want upload without redirect to web page. I need to execute this code on server. Here is my code. private async Task<string> Run(string title, string description, string filepath) { var videoID...

Insert file using Google Drive API?

Based on Google Drive API reference guiding how to insert file Files.insert // File's metadata. File body = new File(); body.setTitle(title); body.setDescription(description); body.setMimeType(mimeType); // File's content. fileContent = new; FileContent mediaContent = new FileContent(mimeType, fileContent); try { File file = service.files().insert(body, mediaContent).execute(); // Uncomment the following line to...

Unable to implement Google API 'Search using a specific app'

I am trying to implement the 'Search using a specific app' functionality as per the android documentation. But I am unable to get it working. This is my query 'Ok google, search for xyz on helloapp' Following is my implementation. I have added meta data which is not required, but...

Gmail API: example of a request to the API

I am trying access the Gmail API with my application. I should have done properly all the setup and I am testing a request to the API, in the specific the request to get the messages as read only. My code: public function gmail_get_messages() { $client = new Google_Client(); $client->setApplicationName("Gmail...

How to use nextPageToken in Google Apps Reseller API?

I am writing a simple Java application that fetches all customer subscriptions from Google Apps Reseller using the Reseller API. However I am stuck at paging through the results as the max size is 100 per page and I cannot figure out the next page token. Here is the code...

Google Weather API

I want to make an app using Google weather API. But I don't have any knowledge about it. How do I use API? Could you explain step by step how I start project?

Can one track the usage of a shared resource from google drive

Does anyone here know if you on Google Drive somehow can track if a public shared link to a file have been used? That is, the resource have been downloaded, viewed or otherwise "touched"?...

Google Developer API V3 for video upload in YouTube

I have been using google's reputed API V2 for uploading the videos on YouTube from my web application as there has been up gradation in API to V3 , I am unable to upload the same through the same code. I have tried with the new application for uploading the...

How to save my data in a cloud?

I don't know if this is possible, but I would like to save some data of my website, like images and documents in a cloud like dropbox or google drive and I want that these data are available and visible to someone looking my site. is it possible? (My intention...

Can I associate a user's account with an action to the drive API?

We're looking to make a little webapp to manage our week-long nerf war (humans vs zombies to be precise), and we're thinking about how easy it would be to have Google Sheets be our only backend, and our frontend be entirely javascript/html/css. Let's say there's two actions that can be...

Gmail API: How to get access token?

I am testing the Gmail API. So far I have done the following: I have created the project in the Google Developers Console I have enabled the Gmail API. I have created a new Client ID and the client secret. In my PHP script I have installed the PHP Client...

Freebase Search API - Get All Results

Is it possible now to get all results from Freebase Search API? Today I was trying 2 approaches in Java: 1)" Using "cursor"(integer) and "limit" options. 2) Try to simulate 'Query Editor' ( Using "cursor" from the previous results set (String). But in both of these approaches I...

Getting user credentials using Google+ API

I am trying to include Google sign in in my android application using Google+ Api. I am able to take account details from the user but once signed in I am getting null when requesting for username using call: Plus.PeopleApi.getCurrentPerson(mGoogleApiClient).getDisplayName() And Logcat shows: BasicNetwork.performRequest: Unexpected response code 403 for

Advanced gmail search for received emails only

I'm using the Google gmail API to get emails from peoples gmail account. I filter for emails containing the word "CompanyName" which have a pdf as an attachment. using the following search query: CompanyName filename:pdf. I now want to further specify this by only getting emails that were received, instead...

Google Drive API (GTL) - Create multiple folder paths in order?

I'm using the Google APIs Client Library for Objective-C (GTL) to access the Google Drive API. According to it's Introduction to the Google APIs Client Library for Objective-C, Query execution by the service is inherently asynchronous. Which means when you try to create a path like: root/a/b/c, before you can...

access drive with access token

struggling to understand the oauth2 token and refresh token processes ive got this code $url = ''; $data = array('client_id' => 'clientid', 'client_secret' => 'secret','refresh_token' => 'token','grant_type' => 'refresh_token'); $options = array( 'http' => array( 'header' => "Content-type: application/x-www-form-urlencoded", 'method' => 'POST', 'approval_prompt'=>'force', 'access_type'=>'offline', 'content' => http_build_query($data), ), ); $context...

Google Identity Toolkit returns INVALID_CREDENTIALS

I'm currently trying to implement a forgot password feature using the Google Identity Toolkit. The PHP backend is trying to get the oob code because client (iOS) does not have sufficient privileges. Whenever I run the script I get an error of INVALID_CREDENTIALS, more specifically: oob Code: string(249) "{ "error":...

Limited number of rows returned from Google spreadsheet and the Sheets Api

I have a spreadsheet on Google Drive with 571 rows that I read from an other application. I call it using the Google.GData.Spreadsheets 2.2.0 lib and the following piece of simplified code. static void Main(string[] args) { var certificate = new X509Certificate2("Key.p12", "blahblah", X509KeyStorageFlags.Exportable); const string user = "[email protected]"; var...

Advanced Drive Services in Addons

I have a Google Script that uses the Advanced Drive API service and am now looking to convert this script into an Add-on. However the Drive API needs to be enabled manually by the user before using the service inside the Apps Script. Is it possible to use the advanced...

Are there google apis to update a google sheet

I want to listen to calendar events and update cells in the google sheet. I have found apis for calendar but are there any apis available to update cells in google sheet ? Thanks...

How to create a script to query Google Browserlocation

I'm trying to figure out a way to get geolocation data from Google's Browser location API. I found JSON, CURL and Google's geolocation, and have it working as far as list of access points in range, but my limited cli-fu won't let me parse this into something I can send...

finished with non-zero exit value 2 when I use google login api

I want to access the google account to login my app,and I get: Error:Execution failed for task ':app:dexDebug'. > org.gradle.process.internal.ExecException: Process 'command '/Library/Java/JavaVirtualMachines/jdk1.8.0_40.jdk/Contents/Home/bin/java'' finished with non-zero exit value 2 My build.grade: apply plugin: '' android { compileSdkVersion 22 buildToolsVersion '22.0.1' defaultConfig { applicationId "" minSdkVersion 15 targetSdkVersion 21...

Google Drive API VB.NET Parent Folder of a Folder,google-drive-sdk,folder,parent
I am trying to work with Google Drive API with I have seen a lot of post but I am not able to understand how to choose the right folder to add a file. I have a lot of "Backup" folder but, I assume now, I want to add...

Providing login_hint option for Google Oauth2 redirect

I'm passing in login_hint=1 option as part of Oauth2 request query string but this doesn't appear when I receive a callback from Google Oauth2 after accepting it. I'm only getting: google/oauth2callback?code=4/vadsdaalijfqwo8fdjqojcxadassddsa# I was expecting 1 (which is user id) to come back as part of callback. How do I make...

Is it possible to use service account with google cloud print [duplicate]

This question already has an answer here: Share printer with Google API Service Account 1 answer I have an application that uses google cloud print. The printers are registered on a company google account. I have to change the application to use oAuth now and since the application runs...

Google Drive API 500 null errors when copying

I'm getting this error message (100% of the time) when copying a shared file, using the latest version of php library. And I'm getting the same response via the API explorer: Google_Exception: Error calling POST (500) { "error": { "code": 500, "message": null } } This issue seem...

How can I make a copy of a file in Google Drive via Python?

I wrote a short function in Google Apps script that can make a copy of a specific file that is stored on Google Drive. The purpose of it is that this file is a template and every time I want to create a new document for work I make a...

What is the difference between Android API and Google API?

I have gone through some of the links that difference between the Google API and android API.I have not got clear explanation.Anyone Can you help me please?