Add-on Google Classroom kini tersedia secara umum untuk developer. Lihat
dokumentasi add-on untuk informasi selengkapnya.
Method: courses.courseWork.create
Tetap teratur dengan koleksi
Simpan dan kategorikan konten berdasarkan preferensi Anda.
Membuat tugas kursus.
Tugas kursus yang dihasilkan (dan kiriman siswa yang sesuai) dikaitkan dengan project Konsol Play dari ID klien OAuth yang digunakan untuk membuat permintaan. Permintaan Classroom API untuk mengubah tugas kursus dan kiriman siswa harus dibuat dengan client ID OAuth dari project Konsol Developer terkait.
Metode ini menampilkan kode error berikut:
PERMISSION_DENIED
jika pengguna yang meminta tidak diizinkan untuk mengakses kursus yang diminta, membuat tugas kursus di kursus yang diminta, membagikan lampiran Drive, atau karena error akses.
INVALID_ARGUMENT
jika permintaan memiliki format yang salah.
NOT_FOUND
jika kursus yang diminta tidak ada.
FAILED_PRECONDITION
untuk error permintaan berikut:
Permintaan HTTP
POST https://classroom.googleapis.com/v1/courses/{courseId}/courseWork
URL menggunakan sintaksis gRPC Transcoding.
Parameter jalur
Parameter |
courseId |
string
ID kursus. ID ini dapat berupa ID yang ditetapkan Classroom atau alias .
|
Parameter kueri
Parameter |
previewVersion |
enum (PreviewVersion )
Opsional. Versi pratinjau endpoint. Ini harus ditetapkan untuk mengakses kemampuan API baru yang tersedia bagi developer di Program Pratinjau.
|
Isi permintaan
Isi permintaan memuat instance CourseWork
.
Isi respons
Jika berhasil, isi respons memuat instance CourseWork
yang baru dibuat.
Cakupan otorisasi
Memerlukan cakupan OAuth berikut:
https://www.googleapis.com/auth/classroom.coursework.students
Untuk informasi selengkapnya, lihat Panduan otorisasi.
Kecuali dinyatakan lain, konten di halaman ini dilisensikan berdasarkan Lisensi Creative Commons Attribution 4.0, sedangkan contoh kode dilisensikan berdasarkan Lisensi Apache 2.0. Untuk mengetahui informasi selengkapnya, lihat Kebijakan Situs Google Developers. Java adalah merek dagang terdaftar dari Oracle dan/atau afiliasinya.
Terakhir diperbarui pada 2025-07-25 UTC.
[null,null,["Terakhir diperbarui pada 2025-07-25 UTC."],[],[],null,["# Method: courses.courseWork.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\nCreates course work.\n\nThe resulting course work (and corresponding student submissions) are associated with the Developer Console project of the [OAuth client ID](https://support.google.com/cloud/answer/6158849) used to make the request. Classroom API requests to modify course work and student submissions must be made with an OAuth client ID from the associated Developer Console project.\n\nThis method returns the following error codes:\n\n- `PERMISSION_DENIED` if the requesting user is not permitted to access the requested course, create course work in the requested course, share a Drive attachment, or for [access errors](/workspace/classroom/reference/Access.Errors).\n- `INVALID_ARGUMENT` if the request is malformed.\n- `NOT_FOUND` if the requested course does not exist.\n- `FAILED_PRECONDITION` for the following [request error](/workspace/classroom/reference/Request.Errors):\n - AttachmentNotVisible\n\n### HTTP request\n\n`POST https://classroom.googleapis.com/v1/courses/{courseId}/courseWork`\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. 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| `previewVersion` | `enum (`[PreviewVersion](/workspace/classroom/reference/rest/v1/PreviewVersion)`)` Optional. The preview version of the endpoint. This must be set in order to access new API capabilities made available to developers in the Preview Program. |\n\n### Request body\n\nThe request body contains an instance of [CourseWork](/workspace/classroom/reference/rest/v1/courses.courseWork#CourseWork).\n\n### Response body\n\nIf successful, the response body contains a newly created instance of [CourseWork](/workspace/classroom/reference/rest/v1/courses.courseWork#CourseWork).\n\n### Authorization scopes\n\nRequires the following OAuth scope:\n\n- `https://www.googleapis.com/auth/classroom.coursework.students`\n\nFor more information, see the [Authorization guide](/workspace/guides/configure-oauth-consent)."]]