Google Classroom 外掛程式現已全面開放開發人員使用!詳情請參閱
外掛程式說明文件。
Method: userProfiles.guardianInvitations.patch
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
修改監護人邀請。
目前唯一有效的修改方式,是將 state
從 PENDING
變更為 COMPLETE
。這會撤銷邀請。
這個方法會傳回下列錯誤代碼:
PERMISSION_DENIED
如果目前使用者沒有管理監護人的權限、如果未為相關網域啟用監護人,或發生其他存取錯誤。
FAILED_PRECONDITION
如果監護人連結未處於 PENDING
狀態。
INVALID_ARGUMENT
:如果無法辨識所提供的學生 ID 格式 (不是電子郵件地址,也不是這個 API 的 userId
),或是傳遞的 GuardianInvitation
有 COMPLETE
以外的 state
,或是修改 state
以外的欄位。
NOT_FOUND
:如果提供的學生 ID 有效,但 Classroom 沒有該學生的記錄,或是 id
欄位未提及 Classroom 已知的監護人邀請。
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
的執行例項。
授權範圍
需要下列 OAuth 範圍:
https://www.googleapis.com/auth/classroom.guardianlinks.students
詳情請參閱授權指南。
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-07-25 (世界標準時間)。
[null,null,["上次更新時間: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)."]]