ChannelBanners: insert
コレクションでコンテンツを整理
必要に応じて、コンテンツの保存と分類を行います。
YouTube にチャンネル バナー画像をアップロードします。このメソッドは、チャンネル用のバナー画像を更新する 3 ステップのプロセスのうち、最初の 2 つのステップを示したものです。
channelBanners.insert
メソッドを呼び出して、バイナリ画像データを YouTube にアップロードします。画像のアスペクト比は 16:9 で、2048 x 1152 ピクセル以上である必要があります。2,560×1,440 ピクセルの画像をアップロードすることをおすすめします。- ステップ 1 で API が返すレスポンスから
url
プロパティの値を抽出します。 channels.update
メソッドを呼び出して、チャンネルのブランディング設定を更新します。brandingSettings.image.bannerExternalUrl
プロパティの値を、手順 2 で取得した URL に設定します。
このメソッドはメディア アップロードをサポートしています。アップロードするファイルには、以下の制約が適用されます。
- 最大ファイルサイズ: 6 MB
- 有効なメディア MIME タイプ:
image/jpeg
、image/png
、application/octet-stream
割り当てへの影響: このメソッドの呼び出しでは、50 ユニットの割り当て費用が発生します。
リクエスト
HTTP リクエスト
POST https://www.googleapis.com/upload/youtube/v3/channelBanners/insert
承認
このリクエストは、少なくとも次のうち 1 つのスコープによる承認が必要です。認証と承認の詳細については、OAuth 2.0 承認の実装をご覧ください。
範囲 |
https://www.googleapis.com/auth/youtube.upload |
https://www.googleapis.com/auth/youtube |
https://www.googleapis.com/auth/youtube.force-ssl |
パラメータ
次の表に、このクエリでサポートされているパラメータを示します。このリストのパラメータはすべてクエリ パラメータです。
パラメータ |
オプション パラメータ |
onBehalfOfContentOwner |
string
このパラメータは、適切に承認されたリクエストでのみ使用できます。
注: このパラメータは YouTube コンテンツ パートナー専用です。
onBehalfOfContentOwner パラメータは、リクエストの認証情報で、パラメータ値で指定されたコンテンツ所有者の代理で行動している YouTube CMS ユーザーを識別することを示します。このパラメータは、複数の YouTube チャンネルを所有、管理している YouTube コンテンツ パートナーを対象にしています。このパラメータを使用すると、コンテンツ所有者は一度認証されれば、すべての動画やチャンネル データにアクセスできるようになります。チャンネルごとに認証情報を指定する必要はありません。ユーザー認証に使用する CMS アカウントは、指定された YouTube コンテンツ所有者にリンクされていなければなりません。 |
リクエスト本文
このメソッドを呼び出す場合は、リクエストの本文を指定しないでください。
エラー
次の表に、このメソッドの呼び出しに対する応答として API から返される可能性のあるエラー メッセージを示します。詳細については、YouTube Data API - エラーをご覧ください。
エラーのタイプ |
エラーの詳細 |
説明 |
badRequest (400) |
bannerAlbumFull |
YouTube チャンネル アート アルバムに画像が多すぎます。この問題を解決するには、Google フォトに移動し、アルバム ページに移動して、そのアルバムから一部の画像を削除します。 |
badRequest (400) |
mediaBodyRequired |
リクエストに画像コンテンツが含まれていません。 |
試してみよう:
APIs Explorer を使用してこの API を呼び出し、API リクエストとレスポンスを確認します。
特に記載のない限り、このページのコンテンツはクリエイティブ・コモンズの表示 4.0 ライセンスにより使用許諾されます。コードサンプルは Apache 2.0 ライセンスにより使用許諾されます。詳しくは、Google Developers サイトのポリシーをご覧ください。Java は Oracle および関連会社の登録商標です。
最終更新日 2024-12-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"]],["最終更新日 2024-12-21 UTC。"],[[["This method allows you to upload a channel banner image to YouTube, which is the initial stage of a three-step process for updating a channel's banner image."],["The image uploaded must adhere to specific constraints, requiring a 16:9 aspect ratio, a minimum resolution of 2048x1152 pixels (recommended 2560x1440), a maximum file size of 6MB, and supported MIME types including `image/jpeg`, `image/png`, and `application/octet-stream`."],["After uploading the image, you need to extract the URL from the API response and use it in the `channels.update` method to set the channel's `bannerExternalUrl`."],["Utilizing this API method will incur a quota cost of 50 units, and it necessitates authorization with one of the specified scopes: `https://www.googleapis.com/auth/youtube.upload`, `https://www.googleapis.com/auth/youtube`, or `https://www.googleapis.com/auth/youtube.force-ssl`."],["The content owner can use the `onBehalfOfContentOwner` optional parameter to make the request, by authenticating with their CMS account, allowing to manage multiple channels."]]],["To update a YouTube channel banner, first, use the `channelBanners.insert` method to upload a 16:9 aspect ratio image (at least 2048x1152 pixels, recommended 2560x1440px). The image file must be under 6MB and of `image/jpeg`, `image/png`, or `application/octet-stream` type. Then, extract the image URL from the API response. Finally, use the `channels.update` method to set the `brandingSettings.image.bannerExternalUrl` to the extracted URL. This method has a quota cost of 50 units.\n"]]