Wir aktualisieren die Data API, damit sie der Zählweise von YouTube-Aufrufen für Kurzvideos entspricht.
Weitere Informationen
Activities: insert
Mit Sammlungen den Überblick behalten
Sie können Inhalte basierend auf Ihren Einstellungen speichern und kategorisieren.
YouTube hat die Funktion „Kanalmitteilungen“ eingestellt. Diese Methode wird nicht mehr unterstützt.
Weitere Informationen findest du in der
YouTube-Hilfe.
Postet eine Mitteilung für einen bestimmten Kanal. Der Nutzer, der den Antrag stellt, muss berechtigt sein, im Namen des Kanals zu handeln.
Hinweis:Eine activity
-Ressource kann zwar Informationen zu Aktionen wie der Bewertung eines Videos durch einen Nutzer oder der Markierung eines Videos als Favorit enthalten, Sie müssen jedoch andere API-Methoden verwenden, um diese activity
-Ressourcen zu generieren. Mit der Methode videos.rate()
der API können Sie beispielsweise ein Video bewerten und mit der Methode playlistItems.insert()
ein Video als Favorit markieren.
Kontingentauswirkung:Ein Aufruf dieser Methode hat Kontingentkosten von 50 Einheiten.
Anfrage
HTTP-Anfrage
POST https://www.googleapis.com/youtube/v3/activities
Parameter
In der folgenden Tabelle sind die Parameter aufgeführt, die von dieser Abfrage unterstützt werden. Alle aufgeführten Parameter sind Abfrageparameter.
Parameter |
Erforderliche Parameter |
part |
string
Der Parameter part hat bei diesem Vorgang zwei Funktionen. Sie gibt die Eigenschaften an, die durch den Schreibvorgang festgelegt werden, sowie die Eigenschaften, die in der API-Antwort enthalten sind.
Die folgende Liste enthält die part -Namen, die Sie in den Parameterwert aufnehmen können:
contentDetails
id
snippet
|
Anfragetext
Geben Sie im Anfragetext eine activity-Ressource an.
Für diese Ressource:
Fehler
In der folgenden Tabelle sind die Fehlermeldungen aufgeführt, die die API als Antwort auf einen Aufruf dieser Methode zurückgeben kann. Weitere Informationen finden Sie in der Dokumentation zur Fehlermeldung.
Fehlertyp |
Fehlerdetails |
Beschreibung |
badRequest (400) |
bulletinTextRequired |
Im Request muss die Property description des Objekts snippet verwendet werden, um den Text für den Bulletin-Beitrag anzugeben. |
badRequest (400) |
invalidMetadata |
Die kind -Property stimmt nicht mit dem Typ der angegebenen ID überein. |
forbidden (403) |
forbidden |
Die Anfrage ist nicht richtig autorisiert. |
notFound (404) |
playlistNotFound |
YouTube kann das Video, das du mit dem Communitybeitrag verknüpfen möchtest, nicht finden. Prüfen Sie den Wert des Attributs contentDetails.bulletinPosted.playlistId . |
notFound (404) |
videoNotFound |
YouTube kann das Video, das du mit dem Communitybeitrag verknüpfen möchtest, nicht finden. Prüfen Sie den Wert des Attributs contentDetails.bulletinPosted.videoId . |
userRateLimitExceeded (403) |
rateLimitExceeded |
Die Anfrage kann nicht abgeschlossen werden, da Sie Ihr Kontingent überschritten haben. |
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-08-21 (UTC).
[null,null,["Zuletzt aktualisiert: 2025-08-21 (UTC)."],[[["\u003cp\u003eYouTube's channel bulletin feature has been deprecated and is no longer supported.\u003c/p\u003e\n"],["\u003cp\u003eCreating an activity requires authorization with specific scopes, such as \u003ccode\u003ehttps://www.googleapis.com/auth/youtube\u003c/code\u003e or \u003ccode\u003ehttps://www.googleapis.com/auth/youtube.force-ssl\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003epart\u003c/code\u003e parameter in the request specifies which properties will be modified and included in the API response, such as \u003ccode\u003econtentDetails\u003c/code\u003e, \u003ccode\u003eid\u003c/code\u003e, and \u003ccode\u003esnippet\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eThe request body must include an activity resource, and it is required to provide a value for \u003ccode\u003esnippet.description\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eThis method call has a quota cost of 50 units, and exceeding the quota will result in a \u003ccode\u003euserRateLimitExceeded\u003c/code\u003e error.\u003c/p\u003e\n"]]],["The YouTube channel bulletin feature is deprecated. The API's `activities.insert` method allows posting to a channel. This requires authorization and has a quota cost of 50 units. You must provide `snippet.description` for the bulletin text in the request body. Key parameters include `part`, and the response returns an `activity` resource. Errors can occur due to bad requests, invalid metadata, authorization issues, or exceeding quota limits.\n"],null,["# Activities: insert\n\n**YouTube has deprecated the channel bulletin feature, and this method is no longer supported.** \n\nFor more details, please see the [YouTube Help Center](https://support.google.com/youtube?p=channel-bulletins).\nPosts a bulletin for a specific channel. (The user submitting the request must be authorized to act on the channel's behalf.) \n\n**Note:** Even though an `activity` resource can contain information about actions like a user rating a video or marking a video as a favorite, you need to use other API methods to generate those `activity` resources. For example, you would use the API's [videos.rate()](/youtube/v3/docs/videos/rate) method to rate a video and the [playlistItems.insert()](/youtube/v3/docs/playlistItems/insert) method to mark a video as a favorite.\n\n**Quota impact:** A call to this method has a [quota cost](/youtube/v3/getting-started#quota) of 50 units.\n\nRequest\n-------\n\n### HTTP request\n\n```\nPOST https://www.googleapis.com/youtube/v3/activities\n```\n\n### Authorization\n\nThis request requires authorization with at least one of the following scopes ([read more about authentication and authorization](/youtube/v3/guides/authentication)).\n\n| Scope |\n|-----------------------------------------------------|\n| `https://www.googleapis.com/auth/youtube` |\n| `https://www.googleapis.com/auth/youtube.force-ssl` |\n\n### Parameters\n\nThe following table lists the parameters that this query supports. All of the parameters listed are query parameters.\n\n| Parameters ||\n|--------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|\n| **Required parameters** |||\n| `part` | `string` The **part** parameter serves two purposes in this operation. It identifies the properties that the write operation will set as well as the properties that the API response will include. The following list contains the `part` names that you can include in the parameter value: - `contentDetails` - `id` - `snippet` |\n\n### Request body\n\nProvide an [activity resource](/youtube/v3/docs/activities#resource) in the request body.\nFor that resource:\n\n- You must specify a value for these properties:\n\n - `snippet.description`\n- You can set values for these properties:\n\n - `snippet.description`\n - `contentDetails.bulletin.resourceId`\n\nResponse\n--------\n\nIf successful, this method returns an [activity resource](/youtube/v3/docs/activities#resource) in the response body.\n\nErrors\n------\n\nThe following table identifies error messages that the API could return in response to a call to this method. Please see the [error message](/youtube/v3/docs/errors) documentation for more detail.\n\n| Error type | Error detail | Description |\n|-------------------------------|------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `badRequest (400)` | `bulletinTextRequired` | The request must use the `snippet` object's `description` property to provide the text for the bulletin post. |\n| `badRequest (400)` | `invalidMetadata` | The `kind` property does not match the type of ID provided. |\n| `forbidden (403)` | `forbidden` | The request is not properly authorized. |\n| `notFound (404)` | `playlistNotFound` | YouTube cannot find the video that you are trying to associate with the bulletin post. Check the value of the `contentDetails.bulletinPosted.playlistId` property. |\n| `notFound (404)` | `videoNotFound` | YouTube cannot find the video that you are trying to associate with the bulletin post. Check the value of the `contentDetails.bulletinPosted.videoId` property. |\n| `userRateLimitExceeded (403)` | `rateLimitExceeded` | The request cannot be completed because you have exceeded your [quota](/youtube/v3/getting-started#quota). |"]]