افزونه های Google Classroom اکنون به طور کلی در دسترس توسعه دهندگان هستند! لطفاً برای اطلاعات بیشتر به
اسناد افزونه ها مراجعه کنید.
Method: courses.students.create
با مجموعهها، منظم بمانید
ذخیره و طبقهبندی محتوا براساس اولویتهای شما.
کاربر را به عنوان دانشجوی یک دوره اضافه می کند.
مدیران دامنه مجازند مستقیماً کاربران درون دامنه خود را به عنوان دانشجو به دوره های درون دامنه خود اضافه کنند . دانش آموزان مجاز هستند با استفاده از کد ثبت نام خود را به یک دوره اضافه کنند.
این روش کدهای خطای زیر را برمی گرداند:
-
PERMISSION_DENIED
اگر کاربر درخواست کننده مجاز به ایجاد دانش آموزان در این دوره یا برای خطاهای دسترسی نباشد. - اگر شناسه دوره درخواستی وجود نداشته باشد،
NOT_FOUND
. -
FAILED_PRECONDITION
اگر حساب کاربر درخواستی غیرفعال باشد، برای خطاهای درخواستی زیر:- CourseMemberLimitReached
- CourseNotModifiable
- UserGroupsMembershipLimitReached
- InactiveCourseOwner
-
ALREADY_EXISTS
اگر کاربر قبلاً دانشآموز یا معلم دوره باشد.
درخواست HTTP
POST https://classroom.googleapis.com/v1/courses/{courseId}/students
URL از دستور GRPC Transcoding استفاده می کند.
پارامترهای مسیر
پارامترها |
---|
courseId | string شناسه دوره برای ایجاد دانش آموز. این شناسه می تواند شناسه اختصاص داده شده توسط Classroom یا alias باشد. |
پارامترهای پرس و جو
پارامترها |
---|
enrollmentCode | string کد ثبت نام دوره برای ایجاد دانش آموز. در صورتی که userId با کاربر درخواست کننده مطابقت داشته باشد، این کد مورد نیاز است. اگر کاربر درخواست کننده دارای مجوزهای مدیریتی برای ایجاد دانش آموزان برای هر کاربر باشد، ممکن است حذف شود. |
درخواست بدن
بدنه درخواست شامل نمونه ای از Student
است.
بدن پاسخگو
در صورت موفقیت آمیز بودن، بدنه پاسخ حاوی نمونه جدیدی از Student
است.
محدوده مجوز
به یکی از حوزه های OAuth زیر نیاز دارد:
-
https://www.googleapis.com/auth/classroom.rosters
-
https://www.googleapis.com/auth/classroom.profile.emails
-
https://www.googleapis.com/auth/classroom.profile.photos
برای اطلاعات بیشتر، به راهنمای مجوز مراجعه کنید.
جز در مواردی که غیر از این ذکر شده باشد،محتوای این صفحه تحت مجوز Creative Commons Attribution 4.0 License است. نمونه کدها نیز دارای مجوز Apache 2.0 License است. برای اطلاع از جزئیات، به خطمشیهای سایت Google Developers مراجعه کنید. جاوا علامت تجاری ثبتشده Oracle و/یا شرکتهای وابسته به آن است.
تاریخ آخرین بهروزرسانی 2025-07-25 بهوقت ساعت هماهنگ جهانی.
[null,null,["تاریخ آخرین بهروزرسانی 2025-07-25 بهوقت ساعت هماهنگ جهانی."],[],[],null,["# Method: courses.students.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- [Try it!](#try-it)\n\nAdds a user as a student of a course.\n\nDomain administrators are permitted to [directly add](https://developers.google.com/workspace/classroom/guides/manage-users) users within their domain as students to courses within their domain. Students are permitted to add themselves to a course using an enrollment code.\n\nThis method returns the following error codes:\n\n- `PERMISSION_DENIED` if the requesting user is not permitted to create students in this course or for [access errors](/workspace/classroom/reference/Access.Errors).\n- `NOT_FOUND` if the requested course ID does not exist.\n- `FAILED_PRECONDITION` if the requested user's account is disabled, for the following [request errors](/workspace/classroom/reference/Request.Errors):\n - CourseMemberLimitReached\n - CourseNotModifiable\n - UserGroupsMembershipLimitReached\n - InactiveCourseOwner\n- `ALREADY_EXISTS` if the user is already a student or teacher in the course.\n\n### HTTP request\n\n`POST https://classroom.googleapis.com/v1/courses/{courseId}/students`\n\nThe URL uses [gRPC Transcoding](https://google.aip.dev/127) syntax.\n\n### Path parameters\n\n| Parameters ||\n|------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `courseId` | `string` Identifier of the course to create the student in. This identifier can be either the Classroom-assigned identifier or an [alias](/workspace/classroom/reference/rest/v1/courses.aliases#CourseAlias). |\n\n### Query parameters\n\n| Parameters ||\n|------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `enrollmentCode` | `string` Enrollment code of the course to create the student in. This code is required if [userId](/workspace/classroom/reference/rest/v1/courses.students#Student.FIELDS.user_id) corresponds to the requesting user; it may be omitted if the requesting user has administrative permissions to create students for any user. |\n\n### Request body\n\nThe request body contains an instance of [Student](/workspace/classroom/reference/rest/v1/courses.students#Student).\n\n### Response body\n\nIf successful, the response body contains a newly created instance of [Student](/workspace/classroom/reference/rest/v1/courses.students#Student).\n\n### Authorization scopes\n\nRequires one of the following OAuth scopes:\n\n- `https://www.googleapis.com/auth/classroom.rosters`\n- `\n https://www.googleapis.com/auth/classroom.profile.emails`\n- `\n https://www.googleapis.com/auth/classroom.profile.photos`\n\nFor more information, see the [Authorization guide](/workspace/guides/configure-oauth-consent)."]]