Hiện tại, các nhà phát triển đã có thể sử dụng rộng rãi tiện ích bổ sung của Google Lớp học! Vui lòng xem tài liệu về tiện ích bổ sung để biết thêm thông tin.
Sử dụng bộ sưu tập để sắp xếp ngăn nắp các trang
Lưu và phân loại nội dung dựa trên lựa chọn ưu tiên của bạn.
Nhà phát triển có thể sử dụng API Lớp học của Google để tương tác với bài tập trên lớp trong Lớp học của Google. Một ứng dụng sử dụng API theo cách này được gọi là CourseWork tích hợp.
Đường dẫn tích hợp này thường được dùng để tạo và chấm điểm bài tập có đường liên kết đến các tài nguyên bên ngoài Lớp học. API này cung cấp cho nhà phát triển nhiều quyền truy cập hơn vào việc quản lý khoá học so với
nút Chia sẻ của Lớp học.
Cách hoạt động
Tính năng cốt lõi của việc tích hợp CourseWork là tạo và quản lý bài tập, thông báo và tài liệu khoá học bằng API Lớp học.
Một ví dụ về hành trình phổ biến của người dùng được kích hoạt bằng cách tích hợp CourseWork là cho phép giáo viên khám phá, giao bài tập và chấm điểm nội dung ngay trong trang web hoặc ứng dụng của bạn:
Người dùng là giáo viên đăng nhập vào trang web của bạn.
Giáo viên tìm hoặc tạo nội dung mà họ muốn chia sẻ với lớp học. Giáo viên nhấp vào một nút trên trang web của bạn để gửi nội dung này đến Google Lớp học.
Ứng dụng của bạn gửi yêu cầu đến courses.courseWork.create. Yêu cầu này chứa một đối tượng CourseWork trong nội dung, trong đó có:
Mã khoá học đích.
Tiêu đề của bài tập.
Nội dung mô tả bằng văn bản cho bài tập.
Một linkMaterial có URL dẫn đến nội dung do giáo viên chọn.
Bạn có thể nhập điểm số tối đa có thể đạt được cho nội dung đã chọn.
Một bài tập mới sẽ xuất hiện trong Lớp học kèm theo một tệp đính kèm là đường liên kết.
Đường liên kết này đề cập đến URL được chỉ định trong yêu cầu create. Xem Hình 1 để biết ví dụ.
Một cột mới cho bài tập cũng sẽ xuất hiện trong sổ điểm của Lớp học, bao gồm cả điểm tối đa (nếu có).
Học viên sẽ nhận được bài tập và nhấp vào biểu tượng link Material để mở URL được cung cấp trong một thẻ mới, sau đó xem hoặc hoàn thành nội dung trên trang web của bạn.
Bạn có thể cung cấp các chế độ kiểm soát để học viên nộp bài tập.
Bạn có thể đưa ra yêu cầu courses.courseWork.studentSubmissions.modifyAttachments để thêm tệp đính kèm vào bài tập đã nộp của học viên, chẳng hạn như tệp trên Google Drive hoặc link
Material trỏ đến bài tập của học viên trên trang web của bạn.
Hãy lưu ý những điều sau đây trước khi quyết định xem chế độ tích hợp CourseWork có phải là lựa chọn phù hợp với nhu cầu về sản phẩm của bạn hay không.
Bạn cần phải uỷ quyền cho người dùng và nhắc họ đồng ý. Bạn đang đưa ra yêu cầu API thay mặt cho người dùng. Ví dụ: bạn không thể tạo bài tập trong bất kỳ khoá học nào trên Google Lớp học; bạn chỉ có thể tạo bài tập trong những khoá học mà người dùng được uỷ quyền giảng dạy.
Bạn cần có cách để người dùng chọn một khoá học để nhận nội dung.
Hãy cân nhắc sử dụng courses.list để lấy danh sách các khoá học mà người dùng giảng dạy, sau đó cho phép người dùng chọn một hoặc nhiều khoá học trong danh sách.
Khi người dùng nhấp vào biểu tượng link Material trong Lớp học, đường liên kết sẽ mở ra trong một thẻ mới. Máy chủ của bạn sẽ không nhận được thông tin nào từ Lớp học khi URL mở.
Giáo viên có thể sửa đổi hoặc xoá bài tập trên lớp mà không cần đến nhà phát triển. Điều này có nghĩa là kiến thức của nhà phát triển về khoá học có thể trở nên lỗi thời. Nếu bạn cần nắm được những thay đổi trong bài tập trên lớp, hãy cân nhắc thiết lập thông báo đẩy cho các thay đổi về bài tập trên lớp.
Giáo viên có thể tạo bài tập trong giao diện người dùng Lớp học bằng cách dán đường liên kết đến URL trên trang web của bạn. Bài tập được tạo theo cách này chỉ thuộc quyền sở hữu của giáo viên, vì vậy, bạn sẽ không thể xem, sửa đổi hoặc đặt điểm cho bài tập bằng API Lớp học.
[null,null,["Cập nhật lần gần đây nhất: 2025-08-01 UTC."],[],[],null,["# CourseWork integration\n\nDevelopers can use Google Classroom API to interact with coursework in\nGoogle Classroom. An application that uses the API in this way is referred to\nas a *`CourseWork` integration*.\n| **Key Point:** A `CourseWork` integration allows developers to programmatically access and modify the state of Google Classroom announcements, course materials, assignments, and student submissions. Choose this path if you need a low-cost way to push your content into Classroom.\n\nThis integration path is commonly used to create and grade assignments with\nlinks to resources outside of Classroom. It provides more\ndeveloper access to coursework management as compared to [Classroom Share buttons](/workspace/classroom/guides/sharebutton).\n\nHow it works\n------------\n\nThe core feature of a `CourseWork` integration is the creation and management of\nassignments, announcements, and course materials using Classroom API.\n\nOne example of a common user journey enabled by a `CourseWork` integration is to\nallow teachers to discover, assign, and grade content from within your website\nor application:\n\n1. A teacher user signs in to your website.\n2. The teacher finds or creates content that they want to share with their class. The teacher clicks a button on your website to send this content to Google Classroom.\n3. Your application issues a request to [`courses.courseWork.create`](/workspace/classroom/reference/rest/v1/courses.courseWork/create). The request contains a `CourseWork` object in its body that contains:\n - The destination course ID.\n - The title of the assignment.\n - The text description for the assignment.\n - A `link` [`Material`](/workspace/classroom/reference/rest/v1/Material) with the URL to the content selected by the teacher.\n - Optionally, the maximum score attainable for the selected content.\n4. A new assignment appears in Classroom with a link attachment. The link refers to the URL specified in the `create` request. See Figure 1 for an example.\n5. A new column for the assignment also appears in the Classroom gradebook, including the maximum score if provided.\n6. Students receive the assignment and click the `link Material` to open the provided URL in a new tab and view or complete the content on your website. Optionally, provide controls for the student to [turn in the assignment](/workspace/classroom/guides/manage-coursework#manage_student_response_state).\n7. Optionally, issue a request to [`courses.courseWork.studentSubmissions.modifyAttachments`](/workspace/classroom/reference/rest/v1/courses.courseWork.studentSubmissions/modifyAttachments) to add attachments to a student submission, such as a Google Drive file or `link\n Material` that points to the student's work on your website.\n8. Optionally, issue a request to [`courses.courseWork.studentSubmissions.patch`](/workspace/classroom/reference/rest/v1/courses.courseWork.studentSubmissions/patch) to set the student's grade for the assignment.\n\n**Figure 1.** Teacher view when editing an assignment with `link Material`\ncreated by a `CourseWork` integration.\n\nAlternatively, you could call [`courses.announcements.create`](/workspace/classroom/reference/rest/v1/courses.announcements/create) or\n[`courses.courseWorkMaterials.create`](/workspace/classroom/reference/rest/v1/courses.courseWorkMaterials/create) to create an announcement or course\nmaterial instead of an assignment. See the [Create \\& manage coursework](/workspace/classroom/guides/manage-coursework) and [Set\n\\& update grades](/workspace/classroom/guides/classroom-api/manage-grades) pages for detailed descriptions of the relevant\nClassroom API actions.\n\nConsiderations\n--------------\n\n| **Key Point:** There are some important limitations to a `CourseWork` integration. If these prevent you from realizing your product, consider building a [Google Classroom add-on](/workspace/classroom/add-ons) instead.\n\nKeep the following in mind before deciding if a `CourseWork` integration is the\nright choice for your product needs.\n\n- You need to authorize the user and prompt for their consent. You're making API requests *on the user's behalf* . This means, for example, that you can't create coursework in *any* Google Classroom course; you can only create coursework in courses that the authorized user teaches.\n- You need a way for the user to select a course to receive the content. Consider using [`courses.list`](/workspace/classroom/reference/rest/v1/courses/list) to get a list of the courses taught by the user, then allow the user to select one or more of the courses from the list.\n- When a user clicks a `link Material` in Classroom, the link opens in a new tab. Your server won't receive any information from Classroom when the URL opens.\n- A teacher can modify or delete the coursework independently of the developer. This means that a developer's knowledge of the coursework might become out of date. If you need to be aware of changes in coursework, consider setting up [push notifications](/workspace/classroom/best-practices/push-notifications) for coursework changes.\n- A teacher can create coursework in the Classroom UI with pasted links to URLs on your website. Coursework created in this manner are solely owned by the teacher, so you won't be able to view, modify, or set submission grades using the Classroom API."]]