Stiamo aggiornando l'API Data in modo che corrisponda al modo in cui YouTube conteggia le visualizzazioni di Shorts.
Scopri di più
Activities: insert
Mantieni tutto organizzato con le raccolte
Salva e classifica i contenuti in base alle tue preferenze.
YouTube ha ritirato la funzionalità dei bollettini del canale e questo metodo non è più supportato.
Per maggiori dettagli, consulta il
Centro assistenza YouTube.
Pubblica un bollettino per un canale specifico. L'utente che invia la richiesta deve essere autorizzato ad agire per conto del canale.
Nota:anche se una risorsa activity
può contenere informazioni su azioni come la valutazione di un video o la sua aggiunta ai preferiti da parte di un utente, devi utilizzare altri metodi API per generare queste risorse activity
. Ad esempio, utilizzeresti il metodo videos.rate()
dell'API per valutare un video e il metodo playlistItems.insert()
per contrassegnare un video come preferito.
Impatto sulla quota:una chiamata a questo metodo ha un costo della quota di 50 unità.
Richiesta
Richiesta HTTP
POST https://www.googleapis.com/youtube/v3/activities
Autorizzazione
Questa richiesta richiede l'autorizzazione con almeno uno dei seguenti ambiti (scopri di più su autenticazione e autorizzazione).
Ambito |
https://www.googleapis.com/auth/youtube |
https://www.googleapis.com/auth/youtube.force-ssl |
Parametri
La tabella seguente elenca i parametri supportati da questa query. Tutti i parametri elencati sono parametri di query.
Parametri |
Parametri obbligatori |
part |
string
Il parametro part ha due scopi in questa operazione. Identifica le proprietà che l'operazione di scrittura imposterà, nonché quelle che la risposta dell'API includerà.
Il seguente elenco contiene i nomi part che puoi includere nel valore del parametro:
contentDetails
id
snippet
|
Corpo della richiesta
Fornisci una risorsa attività nel corpo della richiesta.
Per quella risorsa:
Risposta
In caso di esito positivo, questo metodo restituisce una risorsa attività nel corpo della risposta.
Errori
La seguente tabella identifica i messaggi di errore che l'API potrebbe restituire in risposta a una chiamata a questo metodo. Per ulteriori dettagli, consulta la documentazione relativa al messaggio di errore.
Tipo di errore |
Dettaglio errore |
Descrizione |
badRequest (400) |
bulletinTextRequired |
La richiesta deve utilizzare la proprietà description dell'oggetto snippet per fornire il testo del post del bollettino. |
badRequest (400) |
invalidMetadata |
La proprietà kind non corrisponde al tipo di ID fornito. |
forbidden (403) |
forbidden |
La richiesta non è autorizzata correttamente. |
notFound (404) |
playlistNotFound |
YouTube non riesce a trovare il video che stai cercando di associare al post del bollettino. Controlla il valore della proprietà contentDetails.bulletinPosted.playlistId . |
notFound (404) |
videoNotFound |
YouTube non riesce a trovare il video che stai cercando di associare al post del bollettino. Controlla il valore della proprietà contentDetails.bulletinPosted.videoId . |
userRateLimitExceeded (403) |
rateLimitExceeded |
La richiesta non può essere completata perché hai superato la quota. |
Salvo quando diversamente specificato, i contenuti di questa pagina sono concessi in base alla licenza Creative Commons Attribution 4.0, mentre gli esempi di codice sono concessi in base alla licenza Apache 2.0. Per ulteriori dettagli, consulta le norme del sito di Google Developers. Java è un marchio registrato di Oracle e/o delle sue consociate.
Ultimo aggiornamento 2025-08-21 UTC.
[[["Facile da capire","easyToUnderstand","thumb-up"],["Il problema è stato risolto","solvedMyProblem","thumb-up"],["Altra","otherUp","thumb-up"]],[["Mancano le informazioni di cui ho bisogno","missingTheInformationINeed","thumb-down"],["Troppo complicato/troppi passaggi","tooComplicatedTooManySteps","thumb-down"],["Obsoleti","outOfDate","thumb-down"],["Problema di traduzione","translationIssue","thumb-down"],["Problema relativo a esempi/codice","samplesCodeIssue","thumb-down"],["Altra","otherDown","thumb-down"]],["Ultimo aggiornamento 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,["**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\nHTTP request \n\n```\nPOST https://www.googleapis.com/youtube/v3/activities\n```\n\nAuthorization\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\nParameters\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\nRequest 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\nIf successful, this method returns an [activity resource](/youtube/v3/docs/activities#resource) in the response body.\n\nErrors\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). |"]]