YouTube API v2.0 – Identifying Feeds Related to a Video Entry

Note: The YouTube Data API (v2) has been officially deprecated as of March 4, 2014. Please refer to our deprecation policy for more information. Please use the YouTube Data API (v3) for new integrations and migrate applications still using the v2 API to the v3 API as well.

Each entry in a YouTube Data API response identifies several API URLs related to the video. For example, the entry identifies URLs that let you request comments for the video or add ratings of the video. Some URLs may be used not only for retrieving information but also for creating, updating or deleting information. For example, you send an HTTP GET request to a URL to retrieve comments for that video and an HTTP POST request to the same URL to add a comment to that video.

Several API functions in this documentation refer to the edit URL for a video or other type of entry. (In a playlists feed, for example, an entry corresponds to a playlist rather than to a video.) Within a feed entry, the edit URL is the value of the href attribute in the <link> tag that has a rel attribute value of edit.

The following XML sample demonstrates how <link> tags appear in a YouTube Data API response. The edit URL in the example is shown in bold text.

<entry gd:etag='W/&quot;C0AMRn47eCp7ImA9WxRQGUw.&quot;'>
  <link rel='http://gdata.youtube.com/schemas/2007#video.ratings'
  <link rel='http://gdata.youtube.com/schemas/2007#video.complaints'
  <link rel='self' type='application/atom+xml'
  <link rel='edit' type='application/atom+xml'

The Community Features (ratings, comments, etc.), Saving and Collecting Videos (favorite videos, playlists, etc.), and Enabling User Interaction (profiles, etc.) sections all present use cases describing situations when you might use a particular function to request, create, update or delete resources using the YouTube API. Each use case explains the API requests that you would send as well as the values that you would need to parse from the API responses to allow a user to progress through the use case. Frequently, these steps require you to send an API request to a URL identified within a <link> tag in an API response. The use cases identify the URLs for API requests using the value of the <link> tag's rel attribute.

For example, to retrieve a list of related videos for a video, you would send a GET request to the URL associated with the <link> tag with the rel attribute value http://gdata.youtube.com/schemas/2007#video.related. To add a rating to a video, you would send a POST request to the URL specified in the <link> tag with the rel attribute value http://gdata.youtube.com/schemas/2007#video.ratings.

pagination links

« Previous
Displaying a List of Videos
Next »
Displaying Video Information