Koleksiyonlar ile düzeninizi koruyun
İçeriği tercihlerinize göre kaydedin ve kategorilere ayırın.
Classroom API, geliştiricilerin sorunları ayıklamasına ve son kullanıcılara yararlı, uygulanabilir bilgiler sağlamasına yardımcı olabilecek hata bilgilerini döndürür. Bu kılavuzda, API'den döndürülen hata bilgilerinin nasıl ayrıştırılacağı açıklanmaktadır.
Classroom API, iki düzeyde hata bilgisi döndürür:
Başlıktaki HTTP hata kodu.
Yanıt gövdesinde ek ayrıntılar içeren bir nesne.
Hata mesajı yapısı
Yanıt metninde döndürülen hatalar aşağıdaki alanları içerir:
code: Sayısal HTTP hata kodu. Örneğin, 403.
message: Hata hakkında ek ayrıntılar. Kullanılabildiğinde hata mesajının başına @ ve belirli bir hata türü eklenir. Örneğin,
@ClassroomApiDisabled.
status: HTTP isteğinin durumu. Örneğin, PERMISSION_DENIED veya NOT_FOUND.
Bir istek ClassroomApiDisabled hatasıyla başarısız olursa yanıt şu şekilde olur:
{"error":{"code":403,"message":"@ClassroomApiDisabled The user is not permitted to access the Classroom API.","status":"PERMISSION_DENIED"}}
Yanıt gövdesini, hatanın nedenini ayıklamanıza ve kullanıcılara faydalı bilgiler sağlamanıza yardımcı olması için kullanabilirsiniz. Aynı dizeyle başlayan diğer değerlerle eşleşmeyi önlemek için belirli bir hata mesajını kontrol ederken sondaki boşluğu ekleyin. Sağlanan hata örneğinde, kullanıcılara uygun bilgileri sunmak için ileti alanının "@ClassroomApiDisabled " ile başlayıp başlamadığını kontrol edebilirsiniz.
Classroom API tarafından döndürülebilen bazı hatalar hakkında bilgi edinmek için Sık karşılaşılan hatalar sayfasına bakın.
[[["Anlaması kolay","easyToUnderstand","thumb-up"],["Sorunumu çözdü","solvedMyProblem","thumb-up"],["Diğer","otherUp","thumb-up"]],[["İhtiyacım olan bilgiler yok","missingTheInformationINeed","thumb-down"],["Çok karmaşık / çok fazla adım var","tooComplicatedTooManySteps","thumb-down"],["Güncel değil","outOfDate","thumb-down"],["Çeviri sorunu","translationIssue","thumb-down"],["Örnek veya kod sorunu","samplesCodeIssue","thumb-down"],["Diğer","otherDown","thumb-down"]],["Son güncelleme tarihi: 2025-08-29 UTC."],[],[],null,["# Google Classroom API error structure\n\nThe Classroom API returns error information that can help developers\ndebug issues and provide helpful, actionable information to end users. This\nguide explains how to parse error information returned from the API.\n\nThe Classroom API returns two levels of error information:\n\n- HTTP error code in the header.\n- An object in the response body with additional details.\n\nError message structure\n-----------------------\n\nErrors returned in the response body include the following fields:\n\n- `code`: The numerical HTTP error code. For example, `403`.\n- `message`: Additional details about the error. When available, the error message is prepended with `@` and a specific error type. For example, `@ClassroomApiDisabled`.\n- `status`: The HTTP request status. For example, `PERMISSION_DENIED` or `NOT_FOUND`.\n\nIf a request failed with a [`ClassroomApiDisabled`](/workspace/classroom/troubleshooting/common-errors#classroom-api-disabled) error, the response would\nbe: \n\n {\n \"error\": {\n \"code\": 403,\n \"message\": \"@ClassroomApiDisabled The user is not permitted to access the Classroom API.\",\n \"status\": \"PERMISSION_DENIED\"\n }\n }\n\nYou can use the response body to help you debug the cause of the error and\nprovide helpful information to users. Include a trailing space when checking\nfor a specific error message to avoid matching other values that start with\nthe same string. In the provided error example, you can check if the message\nfield begins with `\"@ClassroomApiDisabled \"` to present appropriate information\nto users.\n\nReference the [Common errors](/workspace/classroom/troubleshooting/common-errors) page for information on some errors that\ncan be returned by the Classroom API."]]