Koleksiyonlar ile düzeninizi koruyun
İçeriği tercihlerinize göre kaydedin ve kategorilere ayırın.
Classroom API, geliştiricilerin sorunları gidermesine ve son kullanıcılara faydalı, uygulanabilir bilgiler sunmasına yardımcı olabilecek hata bilgileri 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 metninde 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: Hatayla ilgili ek ayrıntılar. Mevcut olduğunda hata mesajına @ ve belirli bir hata türü eklenir. Örneğin,
@ClassroomApiDisabled.
status: HTTP isteği 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"}}
Hatanın nedenini gidermenize ve kullanıcılara faydalı bilgiler sunmanıza yardımcı olması için yanıt gövdesini kullanabilirsiniz. Aynı dizeyle başlayan diğer değerlerle eşleşmesini önlemek için belirli bir hata mesajını kontrol ederken sonuna bir boşluk ekleyin. Kullanıcılara uygun bilgileri sunmak için sağlanan hata örneğinde, mesaj alanının "@ClassroomApiDisabled " ile başlayıp başlamadığını kontrol edebilirsiniz.
Classroom API tarafından döndürülebilecek bazı hatalar hakkında bilgi edinmek için Yaygın 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-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."]]],[]]