Method: registrations.create
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
创建 Registration
,让 Google 课堂开始将提供的 feed
中的通知发送到 cloudPubSubTopic
中提供的目的地。
返回已创建的 Registration
。目前,这与参数相同,但填充了服务器分配的字段,例如 expiryTime
和 id
。
请注意,为 expiryTime
或 id
字段指定的任何值都将被忽略。
尽管 Google 课堂会尽最大努力验证 cloudPubSubTopic
并返回错误,但调用方有责任确保其存在,而且 Google 课堂有权向其发布内容。
此方法可能会返回以下错误代码:
PERMISSION_DENIED
,前提是:
- 经过身份验证的用户无权从所请求的字段接收通知;或者
- 当前用户尚未授予具有所请求 Feed 适当范围的当前 Cloud 项目的访问权限。请注意,此功能目前不支持全网域授权。如果请求具有适当的范围,但不存在授权,则返回 [请求错误][
@MissingGrant
错误]。
- 又遇到一个访问错误。
INVALID_ARGUMENT
,前提是:
- 未指定
cloudPubsubTopic
或指定的 cloudPubsubTopic
无效;或者
- 未指定
feed
,或指定的 feed
无效。
NOT_FOUND
,前提是:
- 找不到指定的
feed
,或者发出请求的用户无权确定其是否存在;或者
- 找不到指定的“
cloudPubsubTopic
”,或 Google 课堂尚未获得向其发布内容的权限。
HTTP 请求
POST https://classroom.googleapis.com/v1/registrations
网址采用 gRPC 转码语法。
请求正文
请求正文包含一个 Registration
实例。
响应正文
如果成功,响应正文将包含一个新创建的 Registration
实例。
授权范围
需要以下 OAuth 作用域:
https://www.googleapis.com/auth/classroom.push-notifications
有关详情,请参阅 OAuth 2.0 概览。
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2022-12-15 UTC.
[{
"type": "thumb-down",
"id": "missingTheInformationINeed",
"label":"没有我需要的信息"
},{
"type": "thumb-down",
"id": "tooComplicatedTooManySteps",
"label":"太复杂/步骤太多"
},{
"type": "thumb-down",
"id": "outOfDate",
"label":"内容需要更新"
},{
"type": "thumb-down",
"id": "translationIssue",
"label":"翻译问题"
},{
"type": "thumb-down",
"id": "samplesCodeIssue",
"label":"示例/代码问题"
},{
"type": "thumb-down",
"id": "otherDown",
"label":"其他"
}]
[{
"type": "thumb-up",
"id": "easyToUnderstand",
"label":"易于理解"
},{
"type": "thumb-up",
"id": "solvedMyProblem",
"label":"解决了我的问题"
},{
"type": "thumb-up",
"id": "otherUp",
"label":"其他"
}]