Activities: insert
コレクションでコンテンツを整理
必要に応じて、コンテンツの保存と分類を行います。
YouTube はチャンネルの掲示板機能を非推奨としたため、このメソッドはサポートされなくなりました。
詳しくは、
YouTube ヘルプセンターをご覧ください。
特定のチャンネルに対するお知らせメッセージを投稿します(リクエストを送信するユーザーは、チャンネルに代わって行動する権限を持っている必要があります)。
注: activity
リソースには、ユーザーが動画を評価したり、動画をお気に入りとしてマークしたりするなどのアクションに関する情報を含めることができますが、これらの activity
リソースを生成するには、他の API メソッドを使用する必要があります。たとえば、API の videos.rate()
メソッドを使用して動画を評価し、playlistItems.insert()
メソッドを使用して動画をお気に入りとしてマークします。
割り当てへの影響: このメソッドの呼び出しには、50 ユニットの割り当て費用が発生します。
リクエスト
HTTP リクエスト
POST https://www.googleapis.com/youtube/v3/activities
承認
このリクエストは、少なくとも次のうち 1 つのスコープでの承認が必要です(認証と承認の詳細をご確認ください)。
スコープ |
https://www.googleapis.com/auth/youtube |
https://www.googleapis.com/auth/youtube.force-ssl |
パラメータ
次の表に、このクエリがサポートするパラメータを示します。このリストのパラメータはすべてクエリ パラメータです。
パラメータ |
必須パラメータ |
part |
string
このオペレーションでは、part パラメータには 2 つの目的があります。書き込みオペレーションで設定するプロパティと、API レスポンスに含めるプロパティを識別します。
次のリストには、パラメータ値に含めることができる part 名が含まれています。
contentDetails
id
snippet
|
リクエストの本文
リクエストの本文にアクティビティ リソースを指定します。そのリソースの場合:
-
以下のプロパティの値を指定する必要があります。
-
以下のプロパティの値を設定することができます。
snippet.description
contentDetails.bulletin.resourceId
エラー
次の表に、このメソッドの呼び出しに対するレスポンスとして API が返す可能性のあるエラー メッセージを示します。詳細については、エラー メッセージのドキュメントを参照してください。
エラーのタイプ |
エラーの詳細 |
説明 |
badRequest (400) |
bulletinTextRequired |
リクエストでは、snippet オブジェクトの description プロパティを使用して、掲示板投稿のテキストを指定する必要があります。 |
badRequest (400) |
invalidMetadata |
kind プロパティが、指定された ID のタイプと一致しません。 |
forbidden (403) |
forbidden |
リクエストが適切に承認されていません。 |
notFound (404) |
playlistNotFound |
お知らせメッセージの投稿と動画を関連付けようとしていますが、その動画が見つかりません。contentDetails.bulletinPosted.playlistId プロパティの値を確認します。 |
notFound (404) |
videoNotFound |
お知らせメッセージの投稿と動画を関連付けようとしていますが、その動画が見つかりません。contentDetails.bulletinPosted.videoId プロパティの値を確認します。 |
userRateLimitExceeded (403) |
rateLimitExceeded |
リクエストを完了できません。既に割り当てを超えています。 |
特に記載のない限り、このページのコンテンツはクリエイティブ・コモンズの表示 4.0 ライセンスにより使用許諾されます。コードサンプルは Apache 2.0 ライセンスにより使用許諾されます。詳しくは、Google Developers サイトのポリシーをご覧ください。Java は Oracle および関連会社の登録商標です。
最終更新日 2025-08-21 UTC。
[[["わかりやすい","easyToUnderstand","thumb-up"],["問題の解決に役立った","solvedMyProblem","thumb-up"],["その他","otherUp","thumb-up"]],[["必要な情報がない","missingTheInformationINeed","thumb-down"],["複雑すぎる / 手順が多すぎる","tooComplicatedTooManySteps","thumb-down"],["最新ではない","outOfDate","thumb-down"],["翻訳に関する問題","translationIssue","thumb-down"],["サンプル / コードに問題がある","samplesCodeIssue","thumb-down"],["その他","otherDown","thumb-down"]],["最終更新日 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,[]]