Mantieni tutto organizzato con le raccolte
Salva e classifica i contenuti in base alle tue preferenze.
L'API Classroom restituisce informazioni sugli errori che possono aiutare gli sviluppatori a risolvere i problemi e fornire agli utenti finali informazioni utili e strategiche. Questa guida spiega come analizzare le informazioni sugli errori restituite dall'API.
L'API Classroom restituisce due livelli di informazioni sugli errori:
Codice di errore HTTP nell'intestazione.
Un oggetto nel corpo della risposta con ulteriori dettagli.
Struttura del messaggio di errore
Gli errori restituiti nel corpo della risposta includono i seguenti campi:
code: il codice di errore HTTP numerico. Ad esempio, 403.
message: dettagli aggiuntivi sull'errore. Se disponibile, al messaggio di errore viene anteposto @ e un tipo di errore specifico. Ad esempio,
@ClassroomApiDisabled.
status: lo stato della richiesta HTTP. Ad esempio, PERMISSION_DENIED o
NOT_FOUND.
Se una richiesta non va a buon fine con un errore ClassroomApiDisabled, la risposta sarà:
{"error":{"code":403,"message":"@ClassroomApiDisabled The user is not permitted to access the Classroom API.","status":"PERMISSION_DENIED"}}
Puoi utilizzare il corpo della risposta per aiutarti a eseguire il debug della causa dell'errore e fornire informazioni utili agli utenti. Includi uno spazio finale quando cerchi un messaggio di errore specifico per evitare la corrispondenza con altri valori che iniziano con la stessa stringa. Nell'esempio di errore fornito, puoi verificare se il campo messaggio inizia con "@ClassroomApiDisabled " per presentare informazioni appropriate agli utenti.
Consulta la pagina Errori comuni per informazioni su alcuni errori che possono essere restituiti dall'API Classroom.
[[["Facile da capire","easyToUnderstand","thumb-up"],["Il problema è stato risolto","solvedMyProblem","thumb-up"],["Altra","otherUp","thumb-up"]],[["Mancano le informazioni di cui ho bisogno","missingTheInformationINeed","thumb-down"],["Troppo complicato/troppi passaggi","tooComplicatedTooManySteps","thumb-down"],["Obsoleti","outOfDate","thumb-down"],["Problema di traduzione","translationIssue","thumb-down"],["Problema relativo a esempi/codice","samplesCodeIssue","thumb-down"],["Altra","otherDown","thumb-down"]],["Ultimo aggiornamento 2025-01-30 UTC."],[[["The Classroom API provides error information via HTTP error codes in the header and detailed error objects in the response body."],["Error objects in the response body contain a numerical `code`, a detailed `message` potentially including a specific error type prepended with `@`, and an HTTP request `status`."],["Developers can use the error `message` field, particularly by checking for specific prefixes like `@ClassroomApiDisabled `, to debug issues and inform users."],["The error message structure provided by the API allows for the extraction of the HTTP code, the reason behind the error and its status."],["Refer to the Common Errors page to see a detailed list of possible error messages and the actions that can be taken in response to them."]]],[]]