Google 课堂插件现已面向开发者正式推出!如需了解详情,请参阅
插件文档。
Method: courses.updateGradingPeriodSettings
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
更新课程的评分周期设置。
您可以使用此方法添加、移除或修改单个评分周期。
发出请求的用户和课程所有者必须有权修改评分周期。如需了解详情,请参阅许可要求。
此方法会返回以下错误代码:
PERMISSION_DENIED
如果系统不允许请求用户修改课程的评分周期设置,或者因访问权限错误而导致:
- UserIneligibleToUpdateGradingPeriodSettings
- 如果请求格式不正确,则返回
INVALID_ARGUMENT
。
- 如果请求的课程不存在,则返回
NOT_FOUND
。
HTTP 请求
PATCH https://classroom.googleapis.com/v1/courses/{courseId}/gradingPeriodSettings
网址采用 gRPC 转码语法。
路径参数
参数 |
courseId |
string
必需。课程的标识符。
|
查询参数
参数 |
updateMask |
string (FieldMask format)
用于标识要更新 GradingPeriodSettings 中的哪些字段的掩码。 GradingPeriodSettings gradingPeriods 列表将被更新请求中指定的评分周期完全替换。例如:
- 如果列表中包含没有 ID 的评分周期,则会被视为新添加的评分周期,系统会在您提出请求时为其分配新的 ID。
- 目前存在但在请求中缺少的评分周期将被视为已删除。
- 评分周期如果使用现有 ID 且数据已修改,则会被视为修改。未修改的数据将保持不变。
- 如果包含未知 ID 的评分周期,则会导致错误。
可指定以下字段:
gradingPeriods
applyToExistingCoursework
这是完全限定字段名称的逗号分隔列表。示例:"user.displayName,photo" 。
|
previewVersion |
enum (PreviewVersion )
可选。API 的预览版。必须设置此值,才能使用预览版计划中向开发者提供的新 API 功能。
|
响应正文
如果成功,则响应正文包含一个 GradingPeriodSettings
实例。
授权范围
需要以下 OAuth 范围:
https://www.googleapis.com/auth/classroom.courses
如需了解详情,请参阅授权指南。
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-07-25。
[null,null,["最后更新时间 (UTC):2025-07-25。"],[],[],null,["# Method: courses.updateGradingPeriodSettings\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\nUpdates grading period settings of a course.\n\nIndividual grading periods can be added, removed, or modified using this method.\n\nThe requesting user and course owner must be eligible to modify Grading Periods. For details, see [licensing requirements](https://developers.google.com/workspace/classroom/grading-periods/manage-grading-periods#licensing_requirements).\n\nThis method returns the following error codes:\n\n- `PERMISSION_DENIED` if the requesting user is not permitted to modify the grading period settings in a course or for [access errors](/workspace/classroom/reference/Access.Errors):\n - UserIneligibleToUpdateGradingPeriodSettings\n- `INVALID_ARGUMENT` if the request is malformed.\n- `NOT_FOUND` if the requested course does not exist.\n\n### HTTP request\n\n`PATCH https://classroom.googleapis.com/v1/courses/{courseId}/gradingPeriodSettings`\n\nThe URL uses [gRPC Transcoding](https://google.aip.dev/127) syntax.\n\n### Path parameters\n\n| Parameters ||\n|------------|--------------------------------------------------|\n| `courseId` | `string` Required. The identifier of the course. |\n\n### Query parameters\n\n| Parameters ||\n|------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `updateMask` | `string (`[FieldMask](https://protobuf.dev/reference/protobuf/google.protobuf/#field-mask)` format)` Mask that identifies which fields in the GradingPeriodSettings to update. The GradingPeriodSettings `gradingPeriods` list will be fully replaced by the grading periods specified in the update request. For example: - Grading periods included in the list without an ID are considered additions, and a new ID will be assigned when the request is made. - Grading periods that currently exist, but are missing from the request will be considered deletions. - Grading periods with an existing ID and modified data are considered edits. Unmodified data will be left as is. - Grading periods included with an unknown ID will result in an error. The following fields may be specified: - `gradingPeriods` - `applyToExistingCoursework` This is a comma-separated list of fully qualified names of fields. Example: `\"user.displayName,photo\"`. |\n| `previewVersion` | `enum (`[PreviewVersion](/workspace/classroom/reference/rest/v1/PreviewVersion)`)` Optional. The preview version of the API. 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 [GradingPeriodSettings](/workspace/classroom/reference/rest/v1/GradingPeriodSettings).\n\n### Response body\n\nIf successful, the response body contains an instance of [GradingPeriodSettings](/workspace/classroom/reference/rest/v1/GradingPeriodSettings).\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)."]]