تتوفّر الآن إضافات Google Classroom بشكل عام للمطوّرين. يُرجى الاطّلاع على
مستندات الإضافات للحصول على مزيد من المعلومات.
Method: courses.courseWorkMaterials.addOnAttachments.create
تنظيم صفحاتك في مجموعات
يمكنك حفظ المحتوى وتصنيفه حسب إعداداتك المفضّلة.
لإنشاء مرفق إضافة ضمن مشاركة.
تتطلّب الإضافة الحصول على إذن لإنشاء مرفقات جديدة في المشاركة.
تُرجع هذه الطريقة رموز الأخطاء التالية:
PERMISSION_DENIED
لأخطاء الوصول.
INVALID_ARGUMENT
إذا كان الطلب غير صالح
NOT_FOUND
إذا لم يكن أحد الموارد المحدّدة متوفّرًا
طلب HTTP
POST https://classroom.googleapis.com/v1/courses/{courseId}/courseWorkMaterials/{itemId}/addOnAttachments
يستخدِم عنوان URL بنية تحويل ترميز gRPC.
مَعلمات المسار
المعلمات |
courseId |
string
مطلوب. معرّف الدورة التدريبية.
|
itemId |
string
معرّف Announcement أو CourseWork أو CourseWorkMaterial الذي سيتم إنشاء المرفق بموجبه. هذا الحقل مطلوب، ولكن لم يتم وضع علامة عليه تشير إلى ذلك أثناء نقل البيانات من postId.
|
مَعلمات طلب البحث
المعلمات |
postId (deprecated) |
string
اختياريّ. تم إيقاف هذه السياسة نهائيًا، لذا يُرجى استخدام itemId بدلاً منها.
|
addOnToken |
string
اختياريّ. رمز مميّز يمنح الإذن بالطلب يتم تمرير الرمز المميّز كمَعلمة طلب بحث عند إعادة توجيه المستخدم من Classroom إلى عنوان URL الخاص بالإضافة. يجب استخدام هذا الرمز المميّز للسماح بإنشاء مرفقات في Classroom، ولكنّه اختياري لإنشاء مرفقات مخصّصة للشركاء أولاً. يتم عرض خطأ إذا لم يتم توفيره لإنشاء مرفقات مخصّصة للشركاء، وإذا لم تتطابق مشاريع المطوّرين التي أنشأت المرفق مع عنصر البث الرئيسي.
|
نص الطلب
يحتوي نص الطلب على مثال AddOnAttachment
.
نص الاستجابة
إذا كانت الاستجابة ناجحة، يحتوي نص الاستجابة على مثيل تم إنشاؤه حديثًا من AddOnAttachment
.
نطاقات التفويض
يجب توفير نطاق OAuth التالي:
https://www.googleapis.com/auth/classroom.addons.teacher
لمزيد من المعلومات، يمكنك الاطّلاع على دليل التفويض.
إنّ محتوى هذه الصفحة مرخّص بموجب ترخيص Creative Commons Attribution 4.0 ما لم يُنصّ على خلاف ذلك، ونماذج الرموز مرخّصة بموجب ترخيص Apache 2.0. للاطّلاع على التفاصيل، يُرجى مراجعة سياسات موقع Google Developers. إنّ Java هي علامة تجارية مسجَّلة لشركة Oracle و/أو شركائها التابعين.
تاريخ التعديل الأخير: 2025-07-25 (حسب التوقيت العالمي المتفَّق عليه)
[null,null,["تاريخ التعديل الأخير: 2025-07-25 (حسب التوقيت العالمي المتفَّق عليه)"],[],[],null,["# Method: courses.courseWorkMaterials.addOnAttachments.create\n\n- [HTTP request](#body.HTTP_TEMPLATE)\n- [Path parameters](#body.PATH_PARAMETERS)\n- [Query parameters](#body.QUERY_PARAMETERS)\n- [Request body](#body.request_body)\n- [Response body](#body.response_body)\n- [Authorization scopes](#body.aspect)\n\nCreates an add-on attachment under a post.\n\nRequires the add-on to have permission to create new attachments on the post.\n\nThis method returns the following error codes:\n\n- `PERMISSION_DENIED` for [access errors](/workspace/classroom/reference/Access.Errors).\n- `INVALID_ARGUMENT` if the request is malformed.\n- `NOT_FOUND` if one of the identified resources does not exist.\n\n### HTTP request\n\n`POST https://classroom.googleapis.com/v1/courses/{courseId}/courseWorkMaterials/{itemId}/addOnAttachments`\n\nThe URL uses [gRPC Transcoding](https://google.aip.dev/127) syntax.\n\n### Path parameters\n\n| Parameters ||\n|------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `courseId` | `string` Required. Identifier of the course. |\n| `itemId` | `string` Identifier of the `Announcement`, `CourseWork`, or `CourseWorkMaterial` under which to create the attachment. This field is required, but is not marked as such while we are migrating from postId. |\n\n### Query parameters\n\n| Parameters ||\n|---------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `postId` **(deprecated)** | `string` Optional. Deprecated, use `itemId` instead. |\n| `addOnToken` | `string` Optional. Token that authorizes the request. The token is passed as a query parameter when the user is redirected from Classroom to the add-on's URL. This authorization token is required for in-Classroom attachment creation but optional for partner-first attachment creation. Returns an error if not provided for partner-first attachment creation and the developer projects that created the attachment and its parent stream item do not match. |\n\n### Request body\n\nThe request body contains an instance of [AddOnAttachment](/workspace/classroom/reference/rest/v1/courses.announcements.addOnAttachments#AddOnAttachment).\n\n### Response body\n\nIf successful, the response body contains a newly created instance of [AddOnAttachment](/workspace/classroom/reference/rest/v1/courses.announcements.addOnAttachments#AddOnAttachment).\n\n### Authorization scopes\n\nRequires the following OAuth scope:\n\n- `https://www.googleapis.com/auth/classroom.addons.teacher`\n\nFor more information, see the [Authorization guide](/workspace/guides/configure-oauth-consent)."]]