ส่วนเสริมของ Google Classroom พร้อมให้บริการแก่นักพัฒนาซอฟต์แวร์แล้ว โปรดดูข้อมูลเพิ่มเติมใน
เอกสารส่วนเสริม
Method: courses.create
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
สร้างหลักสูตร
ผู้ใช้ที่ระบุใน ownerId
เป็นเจ้าของหลักสูตรที่สร้างขึ้นและได้รับการเพิ่มเป็นครู ผู้ใช้ที่ขอซึ่งไม่ใช่ผู้ดูแลระบบจะสร้างหลักสูตรได้โดยมีตัวเองเป็นเจ้าของเท่านั้น ผู้ดูแลระบบโดเมนสามารถสร้างหลักสูตรที่เป็นของผู้ใช้ทุกคนในโดเมนของตนได้
เมธอดนี้จะแสดงรหัสข้อผิดพลาดต่อไปนี้
PERMISSION_DENIED
หากผู้ใช้ที่ขอไม่มีสิทธิ์สร้างหลักสูตรหรือข้อผิดพลาดในการเข้าถึง
NOT_FOUND
หากครูผู้สอนหลักไม่ใช่ผู้ใช้ที่ถูกต้อง
FAILED_PRECONDITION
หากบัญชีของเจ้าของหลักสูตรถูกปิดใช้ หรือสำหรับข้อผิดพลาดในการส่งคำขอต่อไปนี้
- UserCannotOwnCourse
- UserGroupsMembershipLimitReached
- CourseTitleCannotContainUrl
ALREADY_EXISTS
หากมีการระบุชื่อแทนใน id
และมีอยู่แล้ว
คำขอ HTTP
POST https://classroom.googleapis.com/v1/courses
URL ใช้ไวยากรณ์การแปลงรหัส gRPC
เนื้อความของคำขอ
เนื้อความของคำขอมีอินสแตนซ์ของ Course
เนื้อหาการตอบกลับ
หากทำสำเร็จ เนื้อหาการตอบกลับจะมีอินสแตนซ์ Course
ที่สร้างขึ้นใหม่
ขอบเขตการให้สิทธิ์
ต้องใช้ขอบเขต OAuth ต่อไปนี้
https://www.googleapis.com/auth/classroom.courses
ดูข้อมูลเพิ่มเติมได้ที่คู่มือการให้สิทธิ์
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-08-08 UTC
[null,null,["อัปเดตล่าสุด 2025-08-08 UTC"],[],[],null,["# Method: courses.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- [Try it!](#try-it)\n\nCreates a course.\n\nThe user specified in `ownerId` is the owner of the created course and added as a teacher. A non-admin requesting user can only create a course with themselves as the owner. Domain admins can create courses owned by any user within their domain.\n\nThis method returns the following error codes:\n\n- `PERMISSION_DENIED` if the requesting user is not permitted to create courses or for [access errors](/workspace/classroom/reference/Access.Errors).\n- `NOT_FOUND` if the primary teacher is not a valid user.\n- `FAILED_PRECONDITION` if the course owner's account is disabled or for the following [request errors](/workspace/classroom/reference/Request.Errors):\n - UserCannotOwnCourse\n - UserGroupsMembershipLimitReached\n - CourseTitleCannotContainUrl\n- `ALREADY_EXISTS` if an alias was specified in the `id` and already exists.\n\n### HTTP request\n\n`POST https://classroom.googleapis.com/v1/courses`\n\nThe URL uses [gRPC Transcoding](https://google.aip.dev/127) syntax.\n\n### Request body\n\nThe request body contains an instance of [Course](/workspace/classroom/reference/rest/v1/courses#Course).\n\n### Response body\n\nIf successful, the response body contains a newly created instance of [Course](/workspace/classroom/reference/rest/v1/courses#Course).\n\n### Authorization scopes\n\nRequires the following OAuth scope:\n\n- `https://www.googleapis.com/auth/classroom.courses`\n\nFor more information, see the [Authorization guide](/workspace/guides/configure-oauth-consent)."]]