تتوفّر الآن إضافات Google Classroom بشكل عام للمطوّرين. يُرجى الاطّلاع على
مستندات الإضافات للحصول على مزيد من المعلومات.
بنية أخطاء Google Classroom API
تنظيم صفحاتك في مجموعات
يمكنك حفظ المحتوى وتصنيفه حسب إعداداتك المفضّلة.
تعرض واجهة برمجة التطبيقات Classroom API معلومات عن الأخطاء يمكن أن تساعد المطوّرين في تحديد المشاكل وحلّها وتقديم معلومات مفيدة وعملية للمستخدمين النهائيين. يوضّح هذا الدليل كيفية تحليل معلومات الخطأ التي تعرضها واجهة برمجة التطبيقات.
تعرض Classroom API مستويَين من معلومات الخطأ:
- رمز خطأ HTTP في العنوان
- كائن في نص الاستجابة يتضمّن تفاصيل إضافية
بنية رسالة الخطأ
تتضمّن الأخطاء التي يتم عرضها في نص الاستجابة الحقول التالية:
-
code
: رمز خطأ HTTP الرقمي مثلاً: 403
message
: تفاصيل إضافية حول الخطأ عند توفّر رسالة الخطأ، يتم إلحاقها بالبادئة @
ونوع خطأ محدّد. على سبيل المثال،
@ClassroomApiDisabled
.
status
: حالة طلب HTTP. على سبيل المثال، PERMISSION_DENIED
أو NOT_FOUND
.
إذا تعذّر تنفيذ طلب بسبب الخطأ ClassroomApiDisabled
، ستكون الاستجابة كما يلي:
{
"error": {
"code": 403,
"message": "@ClassroomApiDisabled The user is not permitted to access the Classroom API.",
"status": "PERMISSION_DENIED"
}
}
يمكنك استخدام نص الرد للمساعدة في تحديد سبب الخطأ وتقديم معلومات مفيدة للمستخدمين. أدرِج مسافة لاحقة عند البحث عن رسالة خطأ معيّنة لتجنُّب مطابقة قيم أخرى تبدأ بالسلسلة نفسها. في مثال الخطأ المقدَّم، يمكنك التحقّق مما إذا كان حقل الرسالة يبدأ بـ "@ClassroomApiDisabled "
لعرض المعلومات المناسبة للمستخدمين.
يمكنك الرجوع إلى صفحة الأخطاء الشائعة للحصول على معلومات حول بعض الأخطاء التي يمكن أن تعرضها واجهة برمجة تطبيقات Classroom.
إنّ محتوى هذه الصفحة مرخّص بموجب ترخيص Creative Commons Attribution 4.0 ما لم يُنصّ على خلاف ذلك، ونماذج الرموز مرخّصة بموجب ترخيص Apache 2.0. للاطّلاع على التفاصيل، يُرجى مراجعة سياسات موقع Google Developers. إنّ Java هي علامة تجارية مسجَّلة لشركة Oracle و/أو شركائها التابعين.
تاريخ التعديل الأخير: 2025-08-29 (حسب التوقيت العالمي المتفَّق عليه)
[null,null,["تاريخ التعديل الأخير: 2025-08-29 (حسب التوقيت العالمي المتفَّق عليه)"],[],[],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."]]