Google's mission …is to organize the world's information and make it universally accessible and useful. Sometimes making information accessible requires making it available in contexts other than a web browser.
Agenda Introduction Getting Started Get Content Interaction Pulling it Together Developer Community
Introduction YouTube in Review REST Google Data API YouTube Data API Entries/Feeds Authentication
REST REpresentationalState Transfer Architectural Style – NOT – Standard More akin to Doc Literal than RPC based Web Service Logical URL’s vs. Static URL’s
REST HTTP Methods Get = List or Retrieve Put = Replace or Update Post = Create Delete = Delete
Pros
Single endpoint for all calls
Lanugage, platform and transport agnostic
Built in error handling
Cons
Conceptually more difficult
Harder to develop with (requires tools)
SOAP (RPC/Doc Literal) Web Services
Multiple Endpoints Pros
Language and platform agnostic
Simpler to develop than SOAP
Concise
Cons
Lack of standards
Tied to HTTP transport
REST Web Services
Get API URL’s for:
Comments
Related Videos
Ratings
Mobile
Versions
Get Video(s)
Edit Video
Delete Video
Google Data API RSS vs. Atom APP Get vs. Post vs. Put vs. Delete
Response Codes Same response codes for HTTP 200, 201, 301, 400, 500 etc.. Codes have similar meaning for each type of call 200 (OK) 400 (Bad Request) 401 (Not Authorized) 404 (Not Found) 500 (Internal Error) Accompanied with error details (XML in payload)
YouTube Data API Version 1 Version 2 (recommended)
YouTubeData API Search for Videos Keywords (tags) Categories Query Params (metadata) Search for Playlists Keywords (tags) Categories Search for Channels Keywords (tags) Categories
YouTube Data API Retrieve Videos Comments Captions Related Videos Video Responses Categories Keywords Playlists Subscriptions Profiles Contacts Messages Activity Feeds Insight Data Feed Favorites
YouTube Data API (cont.) Create Videos Comments Captions Related Videos Video Responses Complaint Rating Contact Message Favorite Playlist Subscription
YouTube Data API (cont.) Update Video Metadata Captions Profiles Playlists Contacts Delete Video Message Favorite Playlist Subscription Contact
YouTube Data API Batch Processing Process multiple types of calls in a single request Each Request in its own <entry> tag
Sample Interaction Query API for videos tagged with “SHU” Display Videos in List Allow user to Select Video to Display Display Single Video Retrieve Comments for that Video Post Comment Login Add to Playlist
Standard Feeds http://code.google.com/apis/youtube/2.0/reference.html#Standard_feeds Top Rated Top Favorites Most Viewed Most Popular Most Recent Etc… Filter by Time Filter by Region Filter by Category
Categories http://gdata.youtube.com/schemas/2007/categories.cat <app:categories [namespaces]> <atom:category term="Film" label="Film & Animation" xml:lang="en-US"> <yt:assignable/> <yt:browsable regions="AU BR CA CZ DE ES FR GB HK IE IL IN IT JP KR MX NL NZ PL PT RU SE TW US"/> </atom:category> </app>
Video by Keyword/Tag http://gdata.youtube.com/feeds/api/videos/ Append /-/keyword/ to video feed URL Use query string ?category=keyword Not (-) Or (|) /-/Kennedy/-Bobby/-Ted/-Patrick /-/Kennedy/Bobby|Ted|Patrick
Video by Category http://gdata.youtube.com/feeds/api/videos/ Append /-/Category/ to video feed URL Use query string ?category=Category Multiple Categories /-/Comedy/Music/Shortmov/ ?category=Comedy,Music,Shortmov Category ARE case sensitive
Channels http://gdata.youtube.com/feeds/api/channels?v=2 Search just like videos using “?q=keywords/tags” <feed [namespaces> … metadata … <openSearch:totalResults /> <openSearch:startIndex /> <openSearch: itemsPerPage /> <entry> <title /> <summary /> <gd:feedlinkurl=“…” hitcount=“…”> </entry> </feed>
Interacting with YouTube Content Authentication Comments Ratings Updating Uploading
ClientLogin https://www.google.com/youtube/accounts/ClientLogin Pass in: Email Passwd Receive: Auth=AIwbFARksypDdUSGGYRI_5v7Z9TaijoPQqpIfCEjTFPAikn_---OC-I1VJtQ YouTubeUser=testuser Send into all requests: Header: Authorization = “GoogleLogin auth= AIwbFARksypDdUSGGYRI_5v7Z9TaijoPQqpIfCEjTFPAikn_---OC-I1VJtQ”
Comments Get Video Feed Look for: <gd:comments> <gd:feedlinkhref=“…” countHint=“…” /> </gd:comments> Pass in
Ratings Link embeded in the video feed <link rel='http://gdata.youtube.com/schemas/2007#video.ratings' type='application/atom+xml' href='http://gdata.youtube.com/feeds/api/videos/VIDEO_ID/ratings'/> Send back to this URL: <entry [namespaces]> <gd:rating value="4" min="1" max="5"/> </entry>
Updating Link embeded in the video feed <link rel='edit' type='application/atom+xml' href='http://gdata.youtube.com/feeds/api/users/andyland74/uploads/914IMX9RSTE'> Send Back to this URL: <entry [namespaces]> <media:group> <media:title type=“…“ /> <media:description type=“…“ /> <media:category scheme=“…“ /> <media:keywords /> </media:group> </entry>
Uploading http://uploads.gdata.youtube.com/feeds/api/users Include in Header Authentication Slug (filename) Include in Body Video File <entry [namespace]> <media:group> <media:title type=”...” /> <media:description type=“…“ /> <media:keywords /> <media:categoryscheme=“…“ /> </media:group> </entry>
Challenges Documentation is poor No true congruity in related links Error messages are non-descriptive
Developer Resources Google Group http://groups.google.com/group/youtube-api-gdata Google Code Help http://code.google.com/support/bin/topic.py?topic=12357
Contact Ron West @notronwest facebook.com/notronwest www.notronwest.com/blog
0 comments
Post a comment