Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

YQL & Yahoo! Apis

4,387 views

Published on

The YQL & Yahoo! Apis presentation done in RHOK Bangalore

Published in: Technology, Design
  • Be the first to comment

  • Be the first to like this

YQL & Yahoo! Apis

  1. 1. YQL & YAHOO! APIS Jai Santhosh Frontend Engineer, Hacker Yahoo!
  2. 2. What We’re Going to Cover• YQL Overview• Making Queries and the Console Sandbox• Demo• Open Data Tables and Execute (Server-Side JavaScript)• Final Lessons
  3. 3. Data manipulationHacks = + Data visualization
  4. 4. The web is a large pile of data!
  5. 5. ProgrammableWeb.com – 4480 Apis
  6. 6. Yahoo! has alsoopened up its data
  7. 7. http://developer.yahoo.com/everything.html
  8. 8. Trouble with Data• Need to find data API• Get Access – Signup for key• Find data endpoint• Read docs to learn what parameters you have• Get data in obscure format• Use data after converting and filtering• More APIs you use, more is your annoyance
  9. 9. To make data access easy on the web, Yahoo! created YQL
  10. 10. =YQL turns web services and data on the web into databases.
  11. 11. select {what} from {where} where {conditions}
  12. 12. You can select, filter, sortand limit data and you can even insert, update and delete from it.
  13. 13. YQL: http://developer.yahoo.com/yql/console
  14. 14. Finding Videos about Bangalore• SELECT * FROM youtube.search where query=bangalore
  15. 15. Selecting Photos of RHOK• SELECT * FROM flickr.photos.search where text="rhok"
  16. 16. Inserting dataINSERT INTO bitly.shorten (login, apiKey, longUrl)VALUES (ME, API_KEY, http://yahoo.com)
  17. 17. updating dataUPDATE social.profile.statusSET status="Using YQL UPDATE”WHERE guid="NJFIDHVPVVISDX7UKED2WHU"
  18. 18. Accessing Private Data • http://query.yahooapis.com/v1/yqlUses OAuth 1.0 for authorizationOAuth is complicated – use one of our SDKs athttps://github.com/yahoo
  19. 19. Retrieving my profile• SELECT * FROM social.contacts WHERE guid=me
  20. 20. Using the YQL Consolemakes it very easy to use it.
  21. 21. url structure• http://query.yahooapis.com/v1/yql?[params]• http://query.yahooapis.com/v1/public/yql?[para ms] Params q= [ YQL QUERY ] format = [ XML / JSON ] diagnostics = [ true / false ] debug = [ true / false ] callback = [ function name ]
  22. 22. Let’s See It
  23. 23. Query Samples• SELECT * FROM twitter.search where q=hackathon’ limit 5• select * from answers.search where query="cars" and type="resolved"• select * from google.translate where q="this is a test" and target="hi";• select * from google.translate where q in (select text from twitter.search where q="hackday") and target=hi;• select * from search.termextract where context in (select description from rss where url=http://rss.news.yahoo.com/rss/topstories)
  24. 24. Query Samples• select * from yahoo.finance.quotes where symbol in ("YHOO","AAPL","GOOG","MSFT")• insert into yahoo.shortener (url, keysize) values (http://www.javarants.com, 5)• select * from craigslist.search where location="bangalore" and type="apa" and query="indiranagar”• select * from html where url="http://finance.yahoo.com/q?s=yhoo" and xpath=//div[@id="yfi_headlines"]/div[2]/ul/li/a’
  25. 25. Making Requests: Flickr URLs<photo farm="3" id="5708163920" isfamily="0" isfriend="0" ispublic="1" owner="31832337@N04" secret="0075137487" server="2496" title="San Francisco"/>
  26. 26. Making Requests: Flickr URLsPhoto URLhttp://farm{$farm}.static.flickr.com/{$server}/{$id}_{$secret}.jpgPhoto Page URLhttp://www.flickr.com/photos/{$owner}/{$id}Photo Owner Profile URLhttp://www.flickr.com/photos/{$owner}
  27. 27. YQL is open – you can get your data tables in our system
  28. 28. Craigslist data table<table> <meta> <author>Yahoo! Inc.</author> <documentationURL>http://craigslist.org/</documentationURL> <sampleQuery> select * from {table} where location="sfbay" and type="sss" and query=“bike” </sampleQuery> </meta> <bindings> … </bindings></table>
  29. 29. Craigslist data table<table> <meta> … </meta> <bindings> <select itemPath="" produces="XML"> <urls> <url>http://{location}.craigslist.org/search/{type}?format=rss</url> </urls> <inputs> <key id="location" type="xs:string" paramType="path" required="true"/> <key id="type" type="xs:string" paramType="path" required="true"/> <key id="query" type="xs:string" paramType="query" required="true"/> </inputs> </select> </bindings></table>
  30. 30. Upload XML to our Github http://github.com/yql/yql-tables
  31. 31. Or to your own Site• The USE clauseUSE http://www.mysite.com/my_table.xmlAS mytable;SELECT * FROM mytableWHERE user=john_doe
  32. 32. You can even write server sidejavascript to build a webservice
  33. 33. Final Lessons• YQL is a skeleton key for all Yahoo! APIs• Open data tables allow you to create new data feeds out of one or many different raw sources• There are 1200+ Tables in YQL covering all major APIs on the web• Use SDKs when accessing private data that requires OAuth
  34. 34. Final Lessons: Links• All Yahoo! APIs and Services• http://developer.yahoo.com/everything.html• YQL Documentation• http://developer.yahoo.com/yql• YQL Console• http://developer.yahoo.com/yql/console• YQL Github Account (Contribute Tables)• http://github.com/yql/yql-tables
  35. 35. http://isithackday.com/hackday-toolbox/
  36. 36. Questions?http://www.slideshare.net/jaisanth Jai Santhosh Twitter: @jaisanth Github: http://github.com/jaisanth
  37. 37. THANK YOU!

×