Limiti e quote
Mantieni tutto organizzato con le raccolte
Salva e classifica i contenuti in base alle tue preferenze.
Limiti e quote proteggono l'infrastruttura di Google da un processo automatizzato che utilizza l'API Reports in modo inappropriato. Le richieste eccessive da parte di un'API potrebbero essere il risultato di un errore di battitura innocuo o il risultato di un sistema progettato in modo inefficiente che effettua chiamate API inutili. Indipendentemente dalla causa, bloccare il traffico da una sorgente specifica una volta raggiunto un determinato livello è necessario per l'integrità complessiva del sistema Google Workspace. Assicura che le azioni di uno sviluppatore non possano influire negativamente sulla community più ampia.
Nell'improbabile caso che la tua richiesta API non vada a buon fine, riceverai una risposta con codice di stato HTTP. Un codice di stato 403 contiene informazioni sull'errore relativo a un input non corretto, mentre un codice di stato HTTP 503 contiene informazioni sull'errore che indicano quali quote dell'API sono state superate. Queste risposte consentono all'applicazione personalizzata di rilevare questi errori e intraprendere le azioni appropriate.
Se le tue richieste devono essere completate in un periodo di tempo fisso, inviale in parallelo o utilizza più thread nella tua applicazione Java o C#. Un esempio di richieste parallele è la richiesta di piccoli batch di email di utenti diversi anziché l'aggiunta o la rimozione di tante email da un utente contemporaneamente. Nel caso di thread, prova a iniziare con 10 thread, un thread per email dell'utente. Tieni presente che i suggerimenti relativi ai thread presentano dei compromessi e non è utile per tutte le situazioni relative all'API. Se il numero di richieste diventa troppo elevato, si verificano errori di quota.
Per tutti gli errori basati sul tempo (massimo N elementi per N secondi per thread), in particolare per gli errori relativi al codice di stato 503, è consigliabile che il codice rilevi l'eccezione e, utilizzando un algoritmo di backoff esponenziale, attendi un leggero ritardo prima di riprovare la chiamata non riuscita. Un esempio di API Reports per un thread prevede di attendere 5 secondi e riprovare la chiamata non riuscita. Se la richiesta ha esito positivo, ripeti questo pattern per gli altri thread. Se la seconda richiesta non va a buon fine, l'applicazione deve ridurre la frequenza della richiesta finché la chiamata non va a buon fine. Ad esempio, aumenta il ritardo iniziale di 5 secondi a 10 secondi e riprova a effettuare la chiamata non riuscita. Inoltre, stabilisci un limite di nuovi tentativi. Ad esempio, riprova la richiesta da 5 a 7 volte con tempi di ritardo diversi prima che l'applicazione restituisca un errore all'utente.
Categorie di limiti API |
Limiti |
Genera report sulle tariffe di QPS e QPD |
L'API limita il numero di richieste per il tuo progetto Google Cloud.
Il valore predefinito impostato nella console Google Cloud è 2400 query al minuto per utente per progetto Google Cloud.
Puoi aumentare questo limite dalla pagina Quote dell'API Admin SDK del tuo progetto Google Cloud.
Se questi limiti vengono superati, il server restituisce un codice di stato HTTP 503. Utilizza l'algoritmo di backoff esponenziale per riprovare a eseguire le richieste.
|
Categorie di quote API |
Quote |
maxRisultati |
Il numero di record elencati in ogni pagina della risposta di un'API va da 1 a 1000 eventi. Il valore predefinito è 1000 record.
|
Altri tipi di limiti |
Limitazioni e linee guida |
Formato dei dati, predefinito |
Il formato predefinito dei dati è JSON. L'API supporta anche il formato Atom.
|
Richieste non autorizzate |
Google non consente richieste non autorizzate all'API. Una richiesta è considerata non autorizzata se non viene fornito alcun token di autorizzazione. Per ulteriori informazioni, vedi Autorizzazione delle richieste.
|
Messaggi di avviso |
- Dati non disponibili. I dati relativi a questa applicazione e per questa data non sono disponibili e non lo saranno in futuro.
- Dati parziali disponibili. I dati relativi a questa applicazione e per questa data potrebbero essere disponibili in futuro.
Per la sintassi degli avvisi dell'API Reports, consulta la documentazione di riferimento sull'API per i clienti e per gli utenti.
|
Salvo quando diversamente specificato, i contenuti di questa pagina sono concessi in base alla licenza Creative Commons Attribution 4.0, mentre gli esempi di codice sono concessi in base alla licenza Apache 2.0. Per ulteriori dettagli, consulta le norme del sito di Google Developers. Java è un marchio registrato di Oracle e/o delle sue consociate.
Ultimo aggiornamento 2025-03-25 UTC.
[null,null,["Ultimo aggiornamento 2025-03-25 UTC."],[],[],null,["# Limits and Quotas\n\nLimits and quotas protect the Google infrastructure from an automated process that uses the Reports API in an inappropriate way. Excessive requests from an API might result from a harmless typo, or might result from an inefficiently designed system that makes needless API calls. Regardless of the cause, blocking traffic from a specific source once it reaches a certain level is necessary for the overall health of the Google Workspace system. It ensures that one developer's actions cannot negatively impact the larger community.\n\nIn the unlikely event that your API request fails, you'll receive an HTTP status code response. A status code of 403 has error information about incorrect input and an HTTP status code of 503 has error information indicating which API quotas have been exceeded. These responses allow your custom application to detect these errors and take appropriate action.\n\nIf your requests need to be completed in a fixed period of time, send your requests in parallel or use multiple threads in your Java or C# application. An example of parallel requests is requesting small batches of emails from different users rather than adding or removing lots of emails from one user simultaneously. In the case of threads, try starting with 10 threads, one thread per user email. Note, the thread recommendation has trade-offs and is not useful for all API situations. If the number of requests gets too high, quota errors will occur.\n\nFor all errors that are time based (maximum of \u003cvar translate=\"no\"\u003eN\u003c/var\u003e things for \u003cvar translate=\"no\"\u003eN\u003c/var\u003e seconds per thread), especially the 503 status code errors, we recommend your code catch the exception and, using an [exponential backoff](http://wikipedia.org/wiki/Truncated_binary_exponential_backoff) algorithm, wait for a small delay before retrying the failed call. A Reports API example for one thread is to wait 5 seconds and retry the failed call. If the request is successful, repeat this pattern for the other threads. If the second request is not successful, your application should scale back on the frequency of the request until a call is successful. For example, increase the initial 5 second delay to 10 seconds and retry your failed call again. Also, decide on a retry limit. For example retry a request 5 to 7 times with different delay times before your application returns an error to the user.\n\n| API Limit Categories | Limits |\n|--------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| Report QPS and QPD rates | The API limits the number of requests for your Google Cloud project. The default value set in the Google Cloud console is 2,400 queries per minute per user per Google Cloud project. You can increase this limit from the [Admin SDK API Quotas page](https://console.cloud.google.com/apis/api/admin.googleapis.com/quotas) of your Google Cloud project. If these limits are exceeded, the server returns an HTTP 503 status code. Use the [exponential backoff](http://wikipedia.org/wiki/Truncated_binary_exponential_backoff) algorithm when retrying your requests. |\n| maxResults | The number of records listed in each page of an API's response is from 1 to 1000 events. The default is 1000 records. |\n\n\n| Other Types of Limits | Limitations and Guidelines |\n|-----------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| Data format, default | The default data format is JSON. The API also supports the Atom format. |\n| Unauthorized requests | Google does not allow unauthorized requests to the API. A request is considered unauthorized if no authorization token is provided. For more information, see [Authorizing requests](/workspace/admin/reports/v1/guides/authorizing). |\n| Warning messages | - Data not available: The data for this application and for this date is not available and will not be available in the future. - Partial data available: The data for this application and for this date may be available in the future. For the Reports API's warning syntax, see the API Reference for [customers](/workspace/admin/reports/v1/reference/customerUsageReports/get) and for [users](/workspace/admin/reports/v1/reference/userUsageReport/get). |"]]