Drive API sharingRateLimitExceeded error

拈花ヽ惹草 提交于 2019-12-01 04:33:52

问题


We have an application that manages the sharing permission for Google Drive files and folders using the Drive API. When our application tries to update the sharing settings of certain files or folders we get a 'sharingRateLimitExceeded' error:

Caused by: com.google.api.server.spi.response.UnauthorizedException: 403 FORBIDDEN {   "code" : 403,   "errors" : [ {
    "domain" : "global",
    "message" : "Rate limit exceeded. User message: \"These item(s) could not be shared because a rate limit was exceeded: SupportMenuItem.class\"",
    "reason" : "sharingRateLimitExceeded"   } ],   "message" : "Rate limit exceeded. User message: \"These item(s) could not be shared because a rate limit was exceeded: FILENAME\"" }

We already configured the API call to not send emails and our service account impersonates different users when changing permissions to avoid exceeding rate limits.

How do we find out which sharing limit is being exceeded? And once we know which sharing limit is being exceeded, where can we find how high that sharing limit is? Is it a per minute sharing limit or a per day sharing limit? We need more information on the error so we can adjust our script so the sharing limits are not exceeded anymore. The information on the error in the documentation is to limited to be of any value to us.


回答1:


{   "code" : 403,   "errors" : [ {
        "domain" : "global",
        "message" : "Rate limit exceeded. User message: \"These item(s) could not be shared because a rate limit was exceeded: SupportMenuItem.class\"",
        "reason" : "sharingRateLimitExceeded"   } ],   "message" : "Rate limit exceeded. User message: \"These item(s) could not be shared because a rate limit was exceeded: FILENAME\"" } 

There is a limit to how many permissions you can insert in a day. That being around 50 in a 24 hour period of time you appear to have hit that quota. It should reset at mid night west cost usa time.

To my knowledge there is no way to extend this quota.

Documentation Handeling API errors

403: Sharing Rate Limit Exceeded

The user has reached a sharing limit. This is often linked with an email limit.

{
 "error": {
  "errors": [
   {
    "domain": "global",
    "message": "Rate limit exceeded. User message: \"These item(s) could not be shared because a rate limit was exceeded: filename",
    "reason": "sharingRateLimitExceeded",
   }
  ],
  "code": 403,
  "message": "Rate Limit Exceeded"
 }
}

Suggested actions:

Do not send emails when sharing lot of files. 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 to impersonate the owner of each document to share (setting the quotaUser parameter).



来源:https://stackoverflow.com/questions/46844246/drive-api-sharingratelimitexceeded-error

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!