Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google Drive API - Permissions - Rate limit exceeded. User message: Sorry, you have exceeded your sharing quota

I've been programatically creating and sharing documents using the Google Drive API. Yesterday I started to receive this error message with every request to insert a permission:

com.google.api.client.googleapis.json.GoogleJsonResponseException: 403 Forbidden
{
  "code" : 403,
  "errors" : [ {
     "domain" : "usageLimits",
     "location" : "user.sharing",
     "locationType" : "other",
     "message" : "Rate limit exceeded. User message: \"Sorry, you have exceeded your sharing quota.\"",
     "reason" : "userRateLimitExceeded"
     } ],
  "message" : "Rate limit exceeded. User message: \"Sorry, you have exceeded your sharing quota.\""
}

I can still programatically create documents, but the request to insert a permission always fails.

This is being done through a Service Account, the idea being that the Service Account would manage these documents for an application and share with authorized users as required.

The error started to occur after inserting somewhere around 50-100 permissions. I've done some research and it sounds like there may be a "feature" in the Google Drive API which limits the number of permissions that can be inserted. Is there some way around this limit?


Update:

For the record, I'm able to create exactly 51 permissions per day. Creating the 52nd permission always fails for a 24 hour period. Unfortunately this restriction renders the permissions API completely useless for Service Accounts.

like image 809
zdegenr Avatar asked Apr 14 '15 14:04

zdegenr


2 Answers

As already stated by @zdegenr, I also experienced that you can only create about 50 permissions per 24 hours. I could solve this issue by disabling sending notification emails via the sendNotificationEmails parameter: https://developers.google.com/drive/v2/reference/permissions/insert .

With this configuration I don't hit the quota anymore...

like image 50
lacco Avatar answered Nov 15 '22 10:11

lacco


Try https://www.google.com.ph/search?q=you+have+exceeded+your+sharing+quota&oq=you+have+exceeded+your+sharing+quota&aqs=chrome..69i57&sourceid=chrome&es_sm=93&ie=UTF-8 There are several suggestions in the results, including a mechanism to request support. It's one of either a rate limit error, in which case slow down, or it's a daily quota issue, in which case request a higher quota. Despite what the google docs say, if you're getting a rate limit, do not do exponential backoff as it will murder your throughput. Instead throttle your requests to around one every 3s, and then speed up or slow down until they go away.

like image 37
pinoyyid Avatar answered Nov 15 '22 09:11

pinoyyid