Google Classroom アドオンの一般提供が開始されました。詳しくは、
アドオンのドキュメントをご覧ください。
Method: registrations.create
コレクションでコンテンツを整理
必要に応じて、コンテンツの保存と分類を行います。
Registration
を作成すると、指定された feed
から cloudPubSubTopic
で指定された宛先に通知の送信が開始されます。
作成された Registration
を返します。現在のところ、これは引数と同じですが、expiryTime
や id
などのサーバー割り当てフィールドが入力されています。
expiryTime
フィールドまたは id
フィールドに指定された値は無視されます。
Classroom は cloudPubSubTopic
を検証し、ベスト エフォート方式でエラーを返す場合がありますが、その存在を確認して Classroom がその公開権限を持っていることを確認するのは呼び出し元の責任です。
このメソッドは、次のエラーコードを返すことがあります。
PERMISSION_DENIED
の場合:
- 認証済みユーザーに、リクエストされたフィールドからの通知を受け取る権限がない。
- 現在のユーザーが、リクエストされたフィードの適切なスコープで現在の Cloud プロジェクトへのアクセス権を付与していない。なお、この目的では現在、ドメイン全体の権限委任はサポートされていません。リクエストに適切なスコープがあっても、付与が存在しない場合、[リクエスト エラー][
@MissingGrant
エラー] が返されます。
- 別のアクセス エラーが発生します。
INVALID_ARGUMENT
の場合:
cloudPubsubTopic
が指定されていないか、指定された cloudPubsubTopic
が有効でない場合。
feed
が指定されていないか、指定された feed
が有効ではありません。
NOT_FOUND
の場合:
- 指定された
feed
が見つからないか、リクエスト元のユーザーにその存在を確認する権限がない。
- 指定した
cloudPubsubTopic
が見つからない、または Classroom に公開する権限が付与されていない。
HTTP リクエスト
POST https://classroom.googleapis.com/v1/registrations
この URL は gRPC Transcoding 構文を使用します。
リクエストの本文
リクエストの本文には Registration
のインスタンスが含まれます。
レスポンスの本文
成功した場合、レスポンスの本文には、新しく作成された Registration
のインスタンスが含まれます。
認可スコープ
次の OAuth スコープが必要です。
https://www.googleapis.com/auth/classroom.push-notifications
詳しくは、認可ガイドをご覧ください。
特に記載のない限り、このページのコンテンツはクリエイティブ・コモンズの表示 4.0 ライセンスにより使用許諾されます。コードサンプルは Apache 2.0 ライセンスにより使用許諾されます。詳しくは、Google Developers サイトのポリシーをご覧ください。Java は Oracle および関連会社の登録商標です。
最終更新日 2025-07-25 UTC。
[null,null,["最終更新日 2025-07-25 UTC。"],[],[],null,["# Method: registrations.create\n\n- [HTTP request](#body.HTTP_TEMPLATE)\n- [Request body](#body.request_body)\n- [Response body](#body.response_body)\n- [Authorization scopes](#body.aspect)\n\nCreates a `Registration`, causing Classroom to start sending notifications from the provided `feed` to the destination provided in `cloudPubSubTopic`.\n\nReturns the created `Registration`. Currently, this will be the same as the argument, but with server-assigned fields such as `expiryTime` and `id` filled in.\n\nNote that any value specified for the `expiryTime` or `id` fields will be ignored.\n\nWhile Classroom may validate the `cloudPubSubTopic` and return errors on a best effort basis, it is the caller's responsibility to ensure that it exists and that Classroom has permission to publish to it.\n\nThis method may return the following error codes:\n\n- `PERMISSION_DENIED` if:\n - the authenticated user does not have permission to receive notifications from the requested field; or\n - the current user has not granted access to the current Cloud project with the appropriate scope for the requested feed. Note that domain-wide delegation of authority is not currently supported for this purpose. If the request has the appropriate scope, but no grant exists, a \\[Request Errors\\]\\[`@MissingGrant` error\\] is returned.\n - another [access error](/workspace/classroom/reference/Access.Errors) is encountered.\n- `INVALID_ARGUMENT` if:\n - no `cloudPubsubTopic` is specified, or the specified `cloudPubsubTopic` is not valid; or\n - no `feed` is specified, or the specified `feed` is not valid.\n- `NOT_FOUND` if:\n - the specified `feed` cannot be located, or the requesting user does not have permission to determine whether or not it exists; or\n - the specified `cloudPubsubTopic` cannot be located, or Classroom has not been granted permission to publish to it.\n\n### HTTP request\n\n`POST https://classroom.googleapis.com/v1/registrations`\n\nThe URL uses [gRPC Transcoding](https://google.aip.dev/127) syntax.\n\n### Request body\n\nThe request body contains an instance of [Registration](/workspace/classroom/reference/rest/v1/registrations#Registration).\n\n### Response body\n\nIf successful, the response body contains a newly created instance of [Registration](/workspace/classroom/reference/rest/v1/registrations#Registration).\n\n### Authorization scopes\n\nRequires the following OAuth scope:\n\n- `https://www.googleapis.com/auth/classroom.push-notifications`\n\nFor more information, see the [Authorization guide](/workspace/guides/configure-oauth-consent)."]]