Google Classroom ऐड-ऑन अब आम तौर पर डेवलपर के लिए उपलब्ध हैं! ज़्यादा जानकारी के लिए, कृपया
ऐड-ऑन दस्तावेज़ देखें.
Method: courses.courseWork.addOnAttachments.create
संग्रह की मदद से व्यवस्थित रहें
अपनी प्राथमिकताओं के आधार पर, कॉन्टेंट को सेव करें और कैटगरी में बांटें.
किसी पोस्ट में ऐड-ऑन अटैचमेंट बनाता है.
इसके लिए, ऐड-ऑन के पास पोस्ट में नए अटैचमेंट बनाने की अनुमति होनी चाहिए.
इस तरीके से, गड़बड़ी के ये कोड मिलते हैं:
- ऐक्सेस से जुड़ी गड़बड़ियों के लिए
PERMISSION_DENIED
.
INVALID_ARGUMENT
अगर अनुरोध गलत है.
NOT_FOUND
अगर पहचाने गए किसी संसाधन का अस्तित्व नहीं है.
एचटीटीपी अनुरोध
POST https://classroom.googleapis.com/v1/courses/{courseId}/courseWork/{itemId}/addOnAttachments
यूआरएल में gRPC ट्रांसकोडिंग सिंटैक्स का इस्तेमाल किया गया है.
पाथ पैरामीटर
पैरामीटर |
courseId |
string
ज़रूरी है. कोर्स का आइडेंटिफ़ायर.
|
itemId |
string
Announcement , CourseWork या CourseWorkMaterial का आइडेंटिफ़ायर, जिसके तहत अटैचमेंट बनाना है. इस फ़ील्ड को भरना ज़रूरी है. हालांकि, postId से माइग्रेट करने के दौरान, इसे ज़रूरी के तौर पर मार्क नहीं किया जाता.
|
क्वेरी पैरामीटर
पैरामीटर |
postId (deprecated) |
string
ज़रूरी नहीं. इस सुविधा के इस्तेमाल पर रोक लगा दी गई है. इसके बजाय, itemId का इस्तेमाल करें.
|
addOnToken |
string
ज़रूरी नहीं. अनुरोध को अनुमति देने वाला टोकन. जब उपयोगकर्ता को Classroom से ऐड-ऑन के यूआरएल पर रीडायरेक्ट किया जाता है, तब टोकन को क्वेरी पैरामीटर के तौर पर पास किया जाता है. Classroom में अटैचमेंट बनाने के लिए, अनुमति का यह टोकन ज़रूरी है. हालांकि, पार्टनर के लिए पहले से मौजूद अटैचमेंट को Classroom में जोड़ने के लिए, यह टोकन ज़रूरी नहीं है. अगर पार्टनर के लिए अटैचमेंट बनाने के लिए यह पैरामीटर नहीं दिया गया है और अटैचमेंट बनाने वाले डेवलपर प्रोजेक्ट और उसके पैरंट स्ट्रीम आइटम का नाम मेल नहीं खाता है, तो गड़बड़ी का मैसेज दिखता है.
|
अनुरोध का मुख्य भाग
अनुरोध के मुख्य भाग में AddOnAttachment
का उदाहरण है.
जवाब का मुख्य भाग
कामयाब रहने पर, जवाब के मुख्य हिस्से में AddOnAttachment
का नया इंस्टेंस शामिल किया जाता है.
अनुमति के दायरे
नीचे दिए गए OAuth के लिंक की ज़रूरत हाेती है:
https://www.googleapis.com/auth/classroom.addons.teacher
ज़्यादा जानकारी के लिए, अनुमति से जुड़ी गाइड देखें.
जब तक कुछ अलग से न बताया जाए, तब तक इस पेज की सामग्री को Creative Commons Attribution 4.0 License के तहत और कोड के नमूनों को Apache 2.0 License के तहत लाइसेंस मिला है. ज़्यादा जानकारी के लिए, Google Developers साइट नीतियां देखें. Oracle और/या इससे जुड़ी हुई कंपनियों का, Java एक रजिस्टर किया हुआ ट्रेडमार्क है.
आखिरी बार 2025-07-25 (UTC) को अपडेट किया गया.
[null,null,["आखिरी बार 2025-07-25 (UTC) को अपडेट किया गया."],[],[],null,["# Method: courses.courseWork.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}/courseWork/{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)."]]