Google 课堂插件现已面向开发者正式推出!如需了解详情,请参阅
插件文档。
Method: userProfiles.guardianInvitations.patch
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
修改监护人邀请。
目前,唯一有效的修改是将 state
从 PENDING
更改为 COMPLETE
。这相当于撤消邀请。
此方法会返回以下错误代码:
PERMISSION_DENIED
:如果当前用户无权管理家长,如果未为相关网域启用家长,或者存在其他访问权限错误。
- 如果监护人关联状态不是
PENDING
,则为 FAILED_PRECONDITION
。
- 如果无法识别所提供学生证件 ID 的格式(它既不是电子邮件地址,也不是此 API 中的
userId
),或者传递的 GuardianInvitation
具有 COMPLETE
以外的 state
,或者它修改了 state
以外的字段,则返回 INVALID_ARGUMENT
。
- 如果提供的学生 ID 是有效的学生 ID,但 Google 课堂中没有该学生的记录,或者
id
字段未提及 Google 课堂已知的监护人邀请,则返回 NOT_FOUND
。
HTTP 请求
PATCH https://classroom.googleapis.com/v1/userProfiles/{studentId}/guardianInvitations/{invitationId}
网址采用 gRPC 转码语法。
路径参数
参数 |
studentId |
string
要修改其监护人邀请的学生的 ID。
|
invitationId |
string
要修改的 GuardianInvitation 的 id 字段。
|
查询参数
参数 |
updateMask |
string (FieldMask format)
用于标识要更新的课程字段的掩码。若要进行更新,必须填写此字段。如果指定无效字段,更新将失败。以下字段有效:
在查询参数中设置此字段时,应将其指定为 updateMask=<field1>,<field2>,...
这是完全限定字段名称的逗号分隔列表。示例:"user.displayName,photo" 。
|
请求正文
请求正文包含一个 GuardianInvitation
实例。
响应正文
如果成功,则响应正文包含一个 GuardianInvitation
实例。
授权范围
需要以下 OAuth 范围:
https://www.googleapis.com/auth/classroom.guardianlinks.students
如需了解详情,请参阅授权指南。
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-07-25。
[null,null,["最后更新时间 (UTC):2025-07-25。"],[],[],null,["# Method: userProfiles.guardianInvitations.patch\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\nModifies a guardian invitation.\n\nCurrently, the only valid modification is to change the `state` from `PENDING` to `COMPLETE`. This has the effect of withdrawing the invitation.\n\nThis method returns the following error codes:\n\n- `PERMISSION_DENIED` if the current user does not have permission to manage guardians, if guardians are not enabled for the domain in question or for other [access errors](/workspace/classroom/reference/Access.Errors).\n- `FAILED_PRECONDITION` if the guardian link is not in the `PENDING` state.\n- `INVALID_ARGUMENT` if the format of the student ID provided cannot be recognized (it is not an email address, nor a `userId` from this API), or if the passed `GuardianInvitation` has a `state` other than `COMPLETE`, or if it modifies fields other than `state`.\n- `NOT_FOUND` if the student ID provided is a valid student ID, but Classroom has no record of that student, or if the `id` field does not refer to a guardian invitation known to Classroom.\n\n### HTTP request\n\n`PATCH https://classroom.googleapis.com/v1/userProfiles/{studentId}/guardianInvitations/{invitationId}`\n\nThe URL uses [gRPC Transcoding](https://google.aip.dev/127) syntax.\n\n### Path parameters\n\n| Parameters ||\n|----------------|-----------------------------------------------------------------------------|\n| `studentId` | `string` The ID of the student whose guardian invitation is to be modified. |\n| `invitationId` | `string` The `id` field of the `GuardianInvitation` to be modified. |\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 on the course to update. This field is required to do an update. The update fails if invalid fields are specified. The following fields are valid: - `state` When set in a query parameter, this field should be specified as `updateMask=\u003cfield1\u003e,\u003cfield2\u003e,...` This is a comma-separated list of fully qualified names of fields. Example: `\"user.displayName,photo\"`. |\n\n### Request body\n\nThe request body contains an instance of [GuardianInvitation](/workspace/classroom/reference/rest/v1/userProfiles.guardianInvitations#GuardianInvitation).\n\n### Response body\n\nIf successful, the response body contains an instance of [GuardianInvitation](/workspace/classroom/reference/rest/v1/userProfiles.guardianInvitations#GuardianInvitation).\n\n### Authorization scopes\n\nRequires the following OAuth scope:\n\n- `https://www.googleapis.com/auth/classroom.guardianlinks.students`\n\nFor more information, see the [Authorization guide](/workspace/guides/configure-oauth-consent)."]]