An activity
resource contains information about an action that a particular channel, or user, has taken on YouTube. The actions reported in activity feeds include rating a video, sharing a video, marking a video as a favorite, commenting on a video, uploading a video, and so forth. Each activity
resource identifies the type of action, the channel associated with the action, and the resource(s) associated with the action, such as the video that was rated or uploaded.
Methods
The API supports the following methods for activities
resources:
- list
- Returns a list of channel activity events that match the request criteria. For example, you can retrieve events associated with a particular channel, events associated with the user's subscriptions and Google+ friends, or the YouTube home page feed, which is customized for each user. Try it now.
- insert
- Posts a bulletin for a specific channel. (The user submitting the request must be authorized to act on the channel's behalf.)
Note: Even though anactivity
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 thoseactivity
resources. For example, you would use the API'svideos.rate()
method to rate a video and theplaylistItems.insert()
method to mark a video as a favorite. Try it now.
Resource representation
The JSON structure below shows the format of a activities
resource:
{ "kind": "youtube#activity", "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, "type": string, "groupId": string }, "contentDetails": { "upload": { "videoId": string }, "like": { "resourceId": { "kind": string, "videoId": string, } }, "favorite": { "resourceId": { "kind": string, "videoId": string, } }, "comment": { "resourceId": { "kind": string, "videoId": string, "channelId": string, } }, "subscription": { "resourceId": { "kind": string, "channelId": string, } }, "playlistItem": { "resourceId": { "kind": string, "videoId": string, }, "playlistId": string, "playlistItemId": string }, "recommendation": { "resourceId": { "kind": string, "videoId": string, "channelId": string, }, "reason": string, "seedResourceId": { "kind": string, "videoId": string, "channelId": string, "playlistId": string } }, "bulletin": { "resourceId": { "kind": string, "videoId": string, "channelId": string, "playlistId": string } }, "social": { "type": string, "resourceId": { "kind": string, "videoId": string, "channelId": string, "playlistId": string }, "author": string, "referenceUrl": string, "imageUrl": string }, "channelItem": { "resourceId": { } }, } }
Properties
The following table defines the properties that appear in this resource:
Property name | Value | Description |
---|---|---|
kind |
string |
Identifies the API resource's type. The value will be youtube#activity . |
etag |
etag |
The Etag of this resource. |
id |
string |
The ID that YouTube uses to uniquely identify the activity. |
snippet |
object |
The snippet object contains basic details about the activity, including the activity's type and group ID. |
snippet.publishedAt |
datetime |
The date and time that the activity occurred. The value is specified in ISO 8601 (YYYY-MM-DDThh:mm:ss.sZ ) format. |
snippet.channelId |
string |
The ID that YouTube uses to uniquely identify the channel associated with the activity. |
snippet.title |
string |
The title of the resource primarily associated with the activity. |
snippet.description |
string |
The description of the resource primarily associated with the activity. |
snippet.thumbnails |
object |
A map of thumbnail images associated with the resource that is primarily associated with the activity. 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) |
object |
Valid key values are:
|
snippet.thumbnails.(key).url |
string |
The image's URL. |
snippet.thumbnails.(key).width |
unsigned integer |
The image's width. |
snippet.thumbnails.(key).height |
unsigned integer |
The image's height. |
snippet.channelTitle |
string |
Channel title for the channel responsible for this activity |
snippet.type |
string |
The type of activity that the resource describes. Valid values for this property are:
|
snippet.groupId |
string |
The group ID associated with the activity. A group ID identifies user events that are associated with the same user and resource. For example, if a user rates a video and marks the same video as a favorite, the entries for those events would have the same group ID in the user's activity feed. In your user interface, you can avoid repetition by grouping events with the same groupId value. |
contentDetails |
object |
The contentDetails object contains information about the content associated with the activity. For example, if the snippet.type value is videoRated , then the contentDetails object's content identifies the rated video. |
contentDetails.upload |
object |
The upload object contains information about the uploaded video. This property is only present if the snippet.type is upload . |
contentDetails.upload.videoId |
string |
The ID that YouTube uses to uniquely identify the uploaded video. |
contentDetails.like |
object |
The like object contains information about a resource that received a positive (like) rating. This property is only present if the snippet.type is like . |
contentDetails.like.resourceId |
object |
The resourceId object contains information that identifies the rated resource. |
contentDetails.like.resourceId.kind |
string |
The type of the API resource. |
contentDetails.like.resourceId.videoId |
string |
The ID that YouTube uses to uniquely identify the video, if the rated resource is a video. This property is only present if the resourceId.kind is youtube#video . |
contentDetails.favorite |
object |
The favorite object contains information about a video that was marked as a favorite video. This property is only present if the snippet.type is favorite . |
contentDetails.favorite.resourceId |
object |
The resourceId object contains information that identifies the resource that was marked as a favorite. |
contentDetails.favorite.resourceId.kind |
string |
The type of the API resource. |
contentDetails.favorite.resourceId.videoId |
string |
The ID that YouTube uses to uniquely identify the favorite video. This property is only present if the resourceId.kind is youtube#video . |
contentDetails.comment |
object |
The comment object contains information about a resource that received a comment. This property is only present if the snippet.type is comment . |
contentDetails.comment.resourceId |
object |
The resourceId object contains information that identifies the resource associated with the comment. |
contentDetails.comment.resourceId.kind |
string |
The type of the API resource. |
contentDetails.comment.resourceId.videoId |
string |
The ID that YouTube uses to uniquely identify the video associated with a comment. This property is only present if the resourceId.kind is youtube#video . |
contentDetails.comment.resourceId.channelId |
string |
The ID that YouTube uses to uniquely identify the channel associated with a comment. This property is only present if the resourceId.kind is youtube#channel . |
contentDetails.subscription |
object |
The subscription object contains information about a channel that a user subscribed to. This property is only present if the snippet.type is subscription . |
contentDetails.subscription.resourceId |
object |
The resourceId object contains information that identifies the resource that the user subscribed to. |
contentDetails.subscription.resourceId.kind |
string |
The type of the API resource. |
contentDetails.subscription.resourceId.channelId |
string |
The ID that YouTube uses to uniquely identify the channel that the user subscribed to. This property is only present if the resourceId.kind is youtube#channel . |
contentDetails.playlistItem |
object |
The playlistItem object contains information about a new playlist item. This property is only present if the snippet.type is playlistItem . |
contentDetails.playlistItem.resourceId |
object |
The resourceId object contains information that identifies the resource that was added to the playlist. |
contentDetails.playlistItem.resourceId.kind |
string |
The type of the API resource. |
contentDetails.playlistItem.resourceId.videoId |
string |
The ID that YouTube uses to uniquely identify the video that was added to the playlist. This property is only present if the resourceId.kind is youtube#video . |
contentDetails.playlistItem.playlistId |
string |
The value that YouTube uses to uniquely identify the playlist. |
contentDetails.playlistItem.playlistItemId |
string |
The value that YouTube uses to uniquely identify the item in the playlist. |
contentDetails.recommendation |
object |
The recommendation object contains information about a recommended resource. This property is only present if the snippet.type is recommendation . |
contentDetails.recommendation.resourceId |
object |
The resourceId object contains information that identifies the recommended resource. |
contentDetails.recommendation.resourceId.kind |
string |
The type of the API resource. |
contentDetails.recommendation.resourceId.videoId |
string |
The ID that YouTube uses to uniquely identify the video, if the recommended resource is a video. This property is only present if the resourceId.kind is youtube#video . |
contentDetails.recommendation.resourceId.channelId |
string |
The ID that YouTube uses to uniquely identify the channel, if the recommended resource is a channel. This property is only present if the resourceId.kind is youtube#channel . |
contentDetails.recommendation.reason |
string |
The reason that the resource is recommended to the user. Valid values for this property are:
|
contentDetails.recommendation.seedResourceId |
object |
The seedResourceId object contains information about the resource that caused the recommendation. |
contentDetails.recommendation.seedResourceId.kind |
string |
The type of the API resource. |
contentDetails.recommendation.seedResourceId.videoId |
string |
The ID that YouTube uses to uniquely identify the video, if the recommendation was caused by a particular video. This property is only present if the seedResourceId.kind is youtube#video . |
contentDetails.recommendation.seedResourceId.channelId |
string |
The ID that YouTube uses to uniquely identify the channel, if the recommendation was caused by a particular channel. This property is only present if the seedResourceId.kind is youtube#channel . |
contentDetails.recommendation.seedResourceId.playlistId |
string |
The ID that YouTube uses to uniquely identify the playlist, if the recommendation was caused by a particular playlist. This property is only present if the seedResourceId.kind is youtube#playlist . |
contentDetails.bulletin |
object |
The bulletin object contains details about a channel bulletin post. This object is only present if the snippet.type is bulletin . |
contentDetails.bulletin.resourceId |
object |
The resourceId object contains information that identifies the resource associated with a bulletin post. |
contentDetails.bulletin.resourceId.kind |
string |
The type of the API resource. |
contentDetails.bulletin.resourceId.videoId |
string |
The ID that YouTube uses to uniquely identify the video featured in a bulletin post, if the post refers to a video. This property will only be present if the value of the bulletin.resourceId.kind property is youtube#video . |
contentDetails.bulletin.resourceId.channelId |
string |
The ID that YouTube uses to uniquely identify the channel featured in a bulletin post, if the post refers to a channel. This property will only be present if the value of the bulletin.resourceId.kind property is youtube#channel . |
contentDetails.bulletin.resourceId.playlistId |
string |
The ID that YouTube uses to uniquely identify the playlist featured in a bulletin post, if the post refers to a playlist. This property will only be present if the value of the bulletin.resourceId.kind property is youtube#playlist . |
contentDetails.social |
object |
The social object contains details about a social network post. This property is only present if the snippet.type is social . |
contentDetails.social.type |
string |
The name of the social network. Valid values for this property are:
|
contentDetails.social.resourceId |
object |
The resourceId object encapsulates information that identifies the resource associated with a social network post. |
contentDetails.social.resourceId.kind |
string |
The type of the API resource. |
contentDetails.social.resourceId.videoId |
string |
The ID that YouTube uses to uniquely identify the video featured in a social network post, if the post refers to a video. This property will only be present if the value of the social.resourceId.kind property is youtube#video . |
contentDetails.social.resourceId.channelId |
string |
The ID that YouTube uses to uniquely identify the channel featured in a social network post, if the post refers to a channel. This property will only be present if the value of the social.resourceId.kind property is youtube#channel . |
contentDetails.social.resourceId.playlistId |
string |
The ID that YouTube uses to uniquely identify the playlist featured in a social network post, if the post refers to a playlist. This property will only be present if the value of the social.resourceId.kind property is youtube#playlist . |
contentDetails.social.author |
string |
The author of the social network post. |
contentDetails.social.referenceUrl |
string |
The URL of the social network post. |
contentDetails.social.imageUrl |
string |
An image of the post's author. |
contentDetails.channelItem |
object |
The channelItem object contains details about a resource that was added to a channel. This property is only present if the snippet.type is channelItem . |
contentDetails.channelItem.resourceId |
object |
The resourceId object contains information that identifies the resource that was added to the channel. |