Implementation: Channels

  • The YouTube Data API (v3) allows retrieval of channel data, including playlist IDs for uploaded and liked videos, by using the channels.list method and including the contentDetails resource part.

  • Information about a specific channel can be retrieved using the channels.list method by setting the mine parameter to true for the authenticated user's channel, the forUsername parameter for a specific username, or the id parameter for a specific channel ID.

  • Channel branding options can be updated in two steps, first retrieving current settings with channels.list and brandingSettings part, then updating with channels.update and setting the channel ID and desired brandingSettings.

  • The API supports managing channel sections using channelSections.list, channelSections.insert, channelSections.update, and channelSections.delete, which can include featured videos like latest uploads or playlist contents.

  • The watermarks.set method allows the upload and setting of a watermark image for a channel's videos, with the watermarks.unset method for deletion, although this cannot be tested with the API Explorer.

This page explains how to use the YouTube Data API (v3) to perform functions related to retrieving and updating channel data. A channel resource includes playlist IDs that identify a channel's uploaded and liked videos. To fetch this information when calling the channels.list method, make sure the part parameter value includes the contentDetails resource part.

Retrieve information about a channel

Call the channels.list method to retrieve information about a particular channel. There are a few ways to identify the channel:

Set a channel's branding information

This example updates a channel's branding options. The example has two steps:

  • Step 1: Retrieve the channel's branding options

    Call the channels.list method and set the part parameter value to brandingSettings and the mine parameter value to true.

    https://developers.google.com/apis-explorer/#p/youtube/v3/youtube.channels.list?
            part=brandingSettings
            &mine=true

    Your application could display the retrieved settings, allowing the user to modify the settings to update.

  • Step 2: Update the channel's branding options

    Call the channels.list method and set the following values:

    • Set the id property to the channel's unique YouTube channel ID. The ID can be extracted from the API response in step 1.
    • Set the part parameter value to brandingSettings.

    The link to the API Explorer below creates a channel resource with the following branding settings:

    {
      "id": "CHANNEL_ID",
      "brandingSettings": {
        "channel": {
          "description": "A great channel to be enjoyed by all.",
          "moderateComments": true,
          "showRelatedChannels": true,
          "showBrowseView": true,
          "featuredChannelsTitle": "Featured Channel Stuff",
          "featuredChannelsUrls": [
            "UC_x5XG1OV2P6uZZ5FSM9Ttw",
            "UCBR8-60-B28hp2BmDPdntcQ",
            "UCK8sQmJBp8GCxrOtXWBpyEA"
          ],
          "profileColor": "#006600"
        }
      }
    }

    To complete the request in the APIs Explorer, you need to set the id property's value to the channel ID of the authenticated user's channel. You should also set the image properties to match your current settings.

    https://developers.google.com/apis-explorer/#p/youtube/v3/youtube.videos.update?
            part=brandingSettings
    

Manage channel sections

The API supports the channelSections.list, channelSections.insert, channelSections.update, and channelSections.delete methods for managing channel sections. A channel section is a set of videos that are featured on a channel. For example, a section could include a channel's latest uploads, most popular uploads, or videos from one or more playlists.

The example below retrieves the channel sections for Google's official YouTube channel. The request calls the channelSections.list method and sets the channelId parameter value to UCK8sQmJBp8GCxrOtXWBpyEA, which is the channel ID for Google's channel.

https://developers.google.com/apis-explorer/#p/youtube/v3/youtube.channelSections.list?
part=snippet,contentDetails
&channelId=UCK8sQmJBp8GCxrOtXWBpyEA

This request requires authorization if, instead of using the channelId parameter, you set the mine parameter value to true. That parameter indicates that you are retrieving channel sections for the currently authenticated user's channel.

Upload and set a watermark image for a channel

You can call the watermarks.set method to upload a watermark image and set it for a channel. The image then displays during playbacks of the specified channel's videos. You can also specify a target channel to which the image will link as well as timing details that determine when the watermark appears and how long it is visible.

The watermarks.unset method deletes a channel's watermark image.

Unfortunately, this query cannot be tested using the APIs Explorer because the APIs Explorer does not support the ability to upload media files, which is a requirement for this method.