ส่วนเสริมของ Google Classroom พร้อมให้บริการแก่นักพัฒนาซอฟต์แวร์แล้ว โปรดดูข้อมูลเพิ่มเติมใน
เอกสารส่วนเสริม
Method: registrations.create
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
สร้าง Registration
ซึ่งจะทำให้ Classroom เริ่มส่งการแจ้งเตือนจาก feed
ที่ระบุไปยังปลายทางที่ระบุใน cloudPubSubTopic
แสดงผล Registration
ที่สร้างขึ้น ปัจจุบันค่านี้จะเหมือนกับอาร์กิวเมนต์ แต่มีการกรอกข้อมูลในช่องที่เซิร์ฟเวอร์กำหนด เช่น expiryTime
และ id
โปรดทราบว่าระบบจะไม่สนใจค่าที่ระบุสำหรับช่อง expiryTime
หรือ id
แม้ว่า Classroom อาจตรวจสอบ cloudPubSubTopic
และแสดงข้อผิดพลาดอย่างเต็มความสามารถ แต่ผู้เรียกใช้มีหน้าที่รับผิดชอบในการตรวจสอบว่า cloudPubSubTopic
มีอยู่จริงและ Classroom มีสิทธิ์เผยแพร่ใน cloudPubSubTopic
ดังกล่าว
วิธีการนี้อาจแสดงโค้ดข้อผิดพลาดต่อไปนี้
PERMISSION_DENIED
if:
- ผู้ใช้ที่ตรวจสอบสิทธิ์แล้วไม่มีสิทธิ์รับการแจ้งเตือนจากช่องที่ขอ หรือ
- ผู้ใช้ปัจจุบันยังไม่ได้ให้สิทธิ์เข้าถึงโปรเจ็กต์ Cloud ในปัจจุบันซึ่งมีขอบเขตที่เหมาะสมสำหรับฟีดที่ขอ โปรดทราบว่าปัจจุบันระบบยังไม่รองรับการมอบสิทธิ์ทั่วทั้งโดเมนเพื่อวัตถุประสงค์นี้ หากคำขอมีขอบเขตที่เหมาะสม แต่ไม่มีการให้สิทธิ์ ระบบจะแสดงผล [ข้อผิดพลาดเกี่ยวกับคำขอ][
@MissingGrant
error]
- พบข้อผิดพลาดในการเข้าถึงอีก
INVALID_ARGUMENT
if:
- ไม่ได้ระบุ
cloudPubsubTopic
หรือ cloudPubsubTopic
ที่ระบุไม่ถูกต้อง หรือ
- ไม่ได้ระบุ
feed
หรือ feed
ที่ระบุไม่ถูกต้อง
NOT_FOUND
if:
- ไม่พบ
feed
ที่ระบุ หรือผู้ใช้ที่ส่งคำขอไม่มีสิทธิ์ตรวจสอบว่า feed
มีอยู่หรือไม่ หรือ
- ไม่พบ
cloudPubsubTopic
ที่ระบุ หรือ Classroom ไม่ได้รับอนุญาตให้เผยแพร่ใน cloudPubsubTopic
คำขอ HTTP
POST https://classroom.googleapis.com/v1/registrations
URL ใช้ไวยากรณ์การแปลง gRPC
เนื้อความของคำขอ
เนื้อความของคำขอมีอินสแตนซ์ของ Registration
เนื้อหาการตอบกลับ
หากทำสำเร็จ เนื้อหาการตอบกลับจะมีอินสแตนซ์ Registration
ที่สร้างขึ้นใหม่
ขอบเขตการให้สิทธิ์
ต้องใช้ขอบเขต OAuth ต่อไปนี้
https://www.googleapis.com/auth/classroom.push-notifications
ดูข้อมูลเพิ่มเติมได้ที่คู่มือการให้สิทธิ์
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-07-25 UTC
[null,null,["อัปเดตล่าสุด 2025-07-25 UTC"],[],[],null,["# Method: registrations.create\n\n- [HTTP request](#body.HTTP_TEMPLATE)\n- [Request body](#body.request_body)\n- [Response body](#body.response_body)\n- [Authorization scopes](#body.aspect)\n\nCreates a `Registration`, causing Classroom to start sending notifications from the provided `feed` to the destination provided in `cloudPubSubTopic`.\n\nReturns the created `Registration`. Currently, this will be the same as the argument, but with server-assigned fields such as `expiryTime` and `id` filled in.\n\nNote that any value specified for the `expiryTime` or `id` fields will be ignored.\n\nWhile Classroom may validate the `cloudPubSubTopic` and return errors on a best effort basis, it is the caller's responsibility to ensure that it exists and that Classroom has permission to publish to it.\n\nThis method may return the following error codes:\n\n- `PERMISSION_DENIED` if:\n - the authenticated user does not have permission to receive notifications from the requested field; or\n - the current user has not granted access to the current Cloud project with the appropriate scope for the requested feed. Note that domain-wide delegation of authority is not currently supported for this purpose. If the request has the appropriate scope, but no grant exists, a \\[Request Errors\\]\\[`@MissingGrant` error\\] is returned.\n - another [access error](/workspace/classroom/reference/Access.Errors) is encountered.\n- `INVALID_ARGUMENT` if:\n - no `cloudPubsubTopic` is specified, or the specified `cloudPubsubTopic` is not valid; or\n - no `feed` is specified, or the specified `feed` is not valid.\n- `NOT_FOUND` if:\n - the specified `feed` cannot be located, or the requesting user does not have permission to determine whether or not it exists; or\n - the specified `cloudPubsubTopic` cannot be located, or Classroom has not been granted permission to publish to it.\n\n### HTTP request\n\n`POST https://classroom.googleapis.com/v1/registrations`\n\nThe URL uses [gRPC Transcoding](https://google.aip.dev/127) syntax.\n\n### Request body\n\nThe request body contains an instance of [Registration](/workspace/classroom/reference/rest/v1/registrations#Registration).\n\n### Response body\n\nIf successful, the response body contains a newly created instance of [Registration](/workspace/classroom/reference/rest/v1/registrations#Registration).\n\n### Authorization scopes\n\nRequires the following OAuth scope:\n\n- `https://www.googleapis.com/auth/classroom.push-notifications`\n\nFor more information, see the [Authorization guide](/workspace/guides/configure-oauth-consent)."]]