Google Classroom-Add-ons sind jetzt allgemein für Entwickler verfügbar. Weitere Informationen finden Sie in der
Dokumentation zu Add-ons.
Method: registrations.create
Mit Sammlungen den Überblick behalten
Sie können Inhalte basierend auf Ihren Einstellungen speichern und kategorisieren.
Erstellt eine Registration
, wodurch Classroom Benachrichtigungen von der angegebenen feed
an das in cloudPubSubTopic
angegebene Ziel sendet.
Gibt die erstellte Registration
zurück. Derzeit entspricht sie dem Argument, enthält aber ausgefüllte serverseitig zugewiesene Felder wie expiryTime
und id
.
Alle für die Felder expiryTime
oder id
angegebenen Werte werden ignoriert.
Classroom kann die cloudPubSubTopic
zwar validieren und Fehler auf Best-Effort-Basis zurückgeben, aber es liegt in der Verantwortung des Aufrufers, dafür zu sorgen, dass sie vorhanden ist und Classroom die Berechtigung hat, dort zu veröffentlichen.
Diese Methode kann die folgenden Fehlercodes zurückgeben:
PERMISSION_DENIED
wenn:
- der authentifizierte Nutzer keine Berechtigung hat, Benachrichtigungen aus dem angeforderten Feld zu erhalten, oder
- Der aktuelle Nutzer hat keinen Zugriff auf das aktuelle Cloud-Projekt mit dem entsprechenden Umfang für den angeforderten Feed gewährt. Die domainweite Delegierung von Berechtigungen wird zu diesem Zweck derzeit nicht unterstützt. Wenn die Anfrage den entsprechenden Umfang hat, aber keine Berechtigung vorhanden ist, wird ein [Request Errors][
@MissingGrant
error] zurückgegeben.
- ein weiterer Zugriffsfehler auftritt.
INVALID_ARGUMENT
wenn:
- kein
cloudPubsubTopic
angegeben ist oder das angegebene cloudPubsubTopic
ungültig ist; oder
- kein
feed
angegeben ist oder das angegebene feed
ungültig ist.
NOT_FOUND
wenn:
- die angegebene
feed
nicht gefunden werden kann oder der anfragende Nutzer keine Berechtigung hat, zu prüfen, ob sie vorhanden ist, oder
- die angegebene
cloudPubsubTopic
nicht gefunden werden kann oder Classroom nicht die Berechtigung zur Veröffentlichung dort gewährt wurde.
HTTP-Anfrage
POST https://classroom.googleapis.com/v1/registrations
Die URL verwendet die Syntax der gRPC-Transcodierung.
Anfragetext
Der Anfragetext enthält eine Instanz von Registration
.
Antworttext
Bei Erfolg enthält der Antworttext eine neu erstellte Instanz von Registration
.
Autorisierungsbereiche
Erfordert den folgenden OAuth-Bereich:
https://www.googleapis.com/auth/classroom.push-notifications
Weitere Informationen finden Sie im Leitfaden zur Autorisierung.
Sofern nicht anders angegeben, sind die Inhalte dieser Seite unter der Creative Commons Attribution 4.0 License und Codebeispiele unter der Apache 2.0 License lizenziert. Weitere Informationen finden Sie in den Websiterichtlinien von Google Developers. Java ist eine eingetragene Marke von Oracle und/oder seinen Partnern.
Zuletzt aktualisiert: 2025-07-25 (UTC).
[null,null,["Zuletzt aktualisiert: 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)."]]