I found this official support document, and here's some brief info below, hope it helps: https://support.google.com/a/answer/2905486?hl=en
Calendar usage limits exceeded. This is the result of an API call. (Don't mix this up with the message "Daily quota exceeded," which points to insufficient API quota.)
If a user sees one of these messages it’s probably due to one of the following reasons:
- Creating too many events
If a user has created more than 10,000 events in his or her calendar within a short period of time, that user might lose calendar edit access.
- Creating too many calendars
If a user creates more than 25 new calendars within a short period of time, that user's calendar might go into read-only mode.
- Sending too many invitations or emails to external guests
In order to prevent spamming, Google Calendar limits the number of invitations a user can send to external guests. This limit varies depending on the action, and is usually between 100-300 guests.
Google Apps users can send invitations to any number of guests from their primary domain, or from secondary domains associated with their primary domain.
- Sharing calendars with too many users
If a user shares one or more calendars with many other users within a short period of time, Google Calendar might switch into read-only mode for that user. It’s almost impossible to reach this limit by updating sharing settings manually, but it can happen with some API-based tools or third-party apps.
Answer from Jinzhao Huo on Stack OverflowI found this official support document, and here's some brief info below, hope it helps: https://support.google.com/a/answer/2905486?hl=en
Calendar usage limits exceeded. This is the result of an API call. (Don't mix this up with the message "Daily quota exceeded," which points to insufficient API quota.)
If a user sees one of these messages it’s probably due to one of the following reasons:
- Creating too many events
If a user has created more than 10,000 events in his or her calendar within a short period of time, that user might lose calendar edit access.
- Creating too many calendars
If a user creates more than 25 new calendars within a short period of time, that user's calendar might go into read-only mode.
- Sending too many invitations or emails to external guests
In order to prevent spamming, Google Calendar limits the number of invitations a user can send to external guests. This limit varies depending on the action, and is usually between 100-300 guests.
Google Apps users can send invitations to any number of guests from their primary domain, or from secondary domains associated with their primary domain.
- Sharing calendars with too many users
If a user shares one or more calendars with many other users within a short period of time, Google Calendar might switch into read-only mode for that user. It’s almost impossible to reach this limit by updating sharing settings manually, but it can happen with some API-based tools or third-party apps.
Having the same issue.
I am using Version 3 code, TwoLeggedOAuthCredentials and the program is an authorized registered client (IOW: the calendars are created on behalf of multiple accounts.)
Last successful large imports: 2013-01-21, 4929 Google requests & 2013-01-22, 1103 Google requests (spread across multiple users)
At about 4% of our quota (https://code.google.com/apis/console/b/0/#project:1077083635926:quotas) the program starts getting the following error: https://www.googleapis.com/calendar/v3/calendars?alt=json returned "Calendar usage limits exceeded.">
If the program is re-run after a time (15 minutes +) it will run a couple more requests before receiving the same error. The calendar information it errored on previously will succeed if re-run after a "cool-off" period. The code itself sleeps for the number of times it receives that error multiplied by 20 seconds and tries ten times (waits 20 seconds after the first error, forty seconds after the second error) but it has increased the time to run the program greatly.
I increased the per user limit from 5 requests/second/user to 10.0 requests/second/user yesterday. So far this has had no noticeable change in behavior. Stepping through the code slowly also doesn't seem to have impact, leading me to believe it is unrelated to the requests per second.
If this is an undocumented per-user quota (and not their well documented request/second/user quota) it is new.
The original question asks "Is there any way that is specially available for testing calendar API?". This is really the core issue. There is a lack of transparency as to what causes this error to occur. I have read https://support.google.com/a/answer/2905486?hl=en, but none of those apply to my application. If I knew what is really causing this error, I might be able to avoid it.
I previously had a Google Calendar simulator for a lot of my testing but it became too arduous and was bypassing testing, so recently converted to using test accounts made of free gmail accounts to target insertions of test data and then read it out. I don't have to try very hard or do a lot of inserts to cause this error. I have implemented exponential backoff starting at 6 seconds; it allowed an insert at 25 minutes after initial failure. That was for a failure which occurred inserting a single event about two minutes later than the previous insert to the same account. The failing insert was the 9th insert of the same data into the same calendar over a period of almost 20 minutes, the 10th in 30 minutes. These are not large numbers in a test environment.
This is a serious impediment to testing. The only way I can see to work around this is to acquire a pool of gmail accounts and pull a new one from the pool when I wear one out. Not only is that more work and maintenance for me, it's bad for google too because of a bunch of accounts that don't map to real users.
If someone has a better idea I'm all ears. What I'd prefer is a way of opting in to testing on specific google accounts, meaning the user expressly asks for google to not be concerned with abuse (assuming that's the rationale for this error).
I think you're making too many API calls at the same time. Give it a time interval or use Batching of Requests. Also use Exponential Backoff to handle 4xx error retries.
Additional note:
The following may be causing your problem according to Calendar usage limits:
Resolution
If users hit the Google Calendar limits, they should be able to edit their calendars normally again within several hours. Users will still be able to view events in Calendar during that period.
More Information If a user sees one of these messages it’s probably due to one of the following reasons:
1. Creating too many events
If a user has created more than 10,000 events in his or her calendar within a short period of time, that user might lose calendar edit access.
2. Creating too many calendars
If a user creates more than 25 new calendars within a short period of time, that user's calendar might go into read-only mode.
3. Sending too many invitations or emails to external guests
In order to prevent spamming, Google Calendar limits the number of invitations a user can send to external guests. This limit varies depending on the action, and is usually between 100-300 guests.
G Suite users can send invitations to any number of guests from their primary domain, or from secondary domains associated with their primary domain.
4. Sharing calendars with too many users
If a user shares one or more calendars with many other users within a short period of time, Google Calendar might switch into read-only mode for that user. It’s almost impossible to reach this limit by updating sharing settings manually, but it can happen with some API-based tools or third-party apps.