AI-generated Key Takeaways
-
A
playlistItemresource represents a resource, such as a video, within a playlist and contains details about how that resource is used within that specific playlist. -
YouTube uses
playlistItemresources to manage a channel's uploaded videos, with each item representing an individual uploaded video. -
The API provides methods for managing
playlistItems, including listing, inserting, updating, and deleting items in a playlist. -
playlistItemresources contain properties likesnippetfor basic details,contentDetailsfor video-specific information, andstatusfor privacy settings. -
The
snippetproperty contains information on the item's title, description, position, thumbnails, the channels associated to it, and the resource included in the playlist.
A playlistItem resource identifies another resource, such as a
video, that is included in a playlist. In addition, the playlistItem resource
contains details about the included resource that pertain specifically to how that resource
is used in that playlist.
YouTube also uses a playlist to identify a channel's list of uploaded videos, with each
playlistItem in that list representing one uploaded video. You can retrieve the
playlist ID for that list from the channel
resource for a given channel. You can then use the
playlistItems.list method to the
list.
Methods
The API supports the following methods for playlistItems resources:
- list
- Returns a collection of playlist items that match the API request parameters. You can retrieve all of the playlist items in a specified playlist or retrieve one or more playlist items by their unique IDs. Try it now.
- insert
- Adds a resource to a playlist. Try it now.
- update
- Modifies a playlist item. For example, you could update the item's position in the playlist. Try it now.
- delete
- Deletes a playlist item. Try it now.
Resource representation
The following JSON structure shows the format of a playlistItems resource:
{
"kind": "youtube#playlistItem",
"etag": etag,
"id": string,
"snippet": {
"publishedAt": datetime,
"channelId": string,
"title": string,
"description": string,
"thumbnails": {
(key): {
"url": string,
"width": unsigned integer,
"height": unsigned integer
}
},
"channelTitle": string,
"videoOwnerChannelTitle": string,
"videoOwnerChannelId": string,
"playlistId": string,
"position": unsigned integer,
"resourceId": {
"kind": string,
"videoId": string,
}
},
"contentDetails": {
"videoId": string,
"startAt": string,
"endAt": string,
"note": string,
"videoPublishedAt": datetime
},
"status": {
"privacyStatus": string
}
}Properties
The following table defines the properties that appear in this resource:
| Properties | |
|---|---|
kind |
stringIdentifies the API resource's type. The value will be youtube#playlistItem. |
etag |
etagThe Etag of this resource. |
id |
stringThe ID that YouTube uses to uniquely identify the playlist item. |
snippet |
objectThe snippet object contains basic details about the playlist item, such as its title and position in the playlist. |
snippet.publishedAt |
datetimeThe date and time that the item was added to the playlist. The value is specified in ISO 8601 format. |
snippet.channelId |
stringThe ID that YouTube uses to uniquely identify the user that added the item to the playlist. |
snippet.title |
stringThe item's title. |
snippet.description |
stringThe item's description. |
snippet.thumbnails |
objectA map of thumbnail images associated with the playlist item. For each object in the map, the key is the name of the thumbnail image, and the value is an object that contains other information about the thumbnail. |
snippet.thumbnails.(key) |
objectValid key values are:
|
snippet.thumbnails.(key).url |
stringThe image's URL. |
snippet.thumbnails.(key).width |
unsigned integerThe image's width. |
snippet.thumbnails.(key).height |
unsigned integerThe image's height. |
snippet.channelTitle |
stringThe channel title of the channel that the playlist item belongs to. |
snippet.videoOwnerChannelTitle |
stringThe channel title of the channel that uploaded this video. |
snippet.videoOwnerChannelId |
stringThe channel ID of the channel that uploaded this video. |
snippet.playlistId |
stringThe ID that YouTube uses to uniquely identify the playlist that the playlist item is in. |
snippet.position |
unsigned integerThe order in which the item appears in the playlist. The value uses a zero-based index, so the first item has a position of 0, the second item has a position of 1, and so forth. |
snippet.resourceId |
objectThe id object contains information that can be used to uniquely identify the resource that is included in the playlist as the playlist item. |
snippet.resourceId.kind |
stringThe kind, or type, of the referred resource. |
snippet.resourceId.videoId |
stringIf the snippet.resourceId.kind property's value is youtube#video, then this property will be present and its value will contain the ID that YouTube uses to uniquely identify the video in the playlist. |
contentDetails |
objectThe contentDetails object is included in the resource if the included item is a YouTube video. The object contains additional information about the video. |
contentDetails.videoId |
stringThe ID that YouTube uses to uniquely identify a video. To retrieve the video resource, set the id query parameter to this value in your API request. |
contentDetails.startAt |
stringNote: This property has been deprecated and, if set, its value is ignored. The time, measured in seconds from the start of the video, when the video should start playing. (The playlist owner can specify the times when the video should start and stop playing when the video is played in the context of the playlist.) The default value is 0. |
contentDetails.endAt |
stringNote: This property has been deprecated and, if set, its value is ignored. The time, measured in seconds from the start of the video, when the video should stop playing. (The playlist owner can specify the times when the video should start and stop playing when the video is played in the context of the playlist.) By default, assume that the video.endTime is the end of the video. |
contentDetails.note |
stringA user-generated note for this item. The property value has a maximum length of 280 characters. |
contentDetails.videoPublishedAt |
datetimeThe date and time that the video was published to YouTube. The value is specified in ISO 8601 format. |
status |
objectThe status object contains information about the playlist item's privacy status. |
status.privacyStatus |
stringThe playlist item's privacy status. The channel that uploaded the video that the playlist item represents can set this value using either the videos.insert or videos.update method. |