1 / 39

Hack Day EU 2011 YQL

"YQL and other hack APIs" presentation for May 2011 Yahoo! Developer Network Hack Day EU in Bucharest, Romania.

jcleblanc
Download Presentation

Hack Day EU 2011 YQL

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. YQL AND THE API HACK STACK Jonathan LeBlanc Principal Software Engineer / Technology Evangelist Twitter: @jcleblanc

  2. WHAT WE’RE GOING TO COVER YQL Overview Making Queries and the Console Sandbox Open Data Tables (a.k.a. Adding New Features into YQL) Execute (Server-Side JavaScript) Final Lessons

  3. WHAT WE’RE GOING TO COVER YQL Overview Making Queries and the Console Sandbox Open Data Tables (a.k.a. Adding New Features into YQL) Execute (Server-Side JavaScript) Final Lessons

  4. OVERVIEW: DON’T REINVENT THE WHEEL!

  5. OVERVIEW: THE COMPONENTS OF YQL YQL Table YQL Service Web API USER

  6. OVERVIEW: YQL FETCHES DATA

  7. OVERVIEW: YQL SETS AND DELETES DATA

  8. OVERVIEW: IS YQL A DATABASE?

  9. OVERVIEW: YQL IS NOT A DATABASE

  10. WHAT WE’RE GOING TO COVER YQL Overview Making Queries and the Console Sandbox Open Data Tables (a.k.a. Adding New Features into YQL) Execute (Server-Side JavaScript) Final Lessons

  11. MAKING REQUESTS: FETCHING DATA SELECT myColumn, myTitle FROM myTable(0, 50) WHERE myColumn = 'value' AND myTitle = 'title‘ LIMIT 3 OFFSET 10

  12. MAKING REQUESTS: INSERTING DATA INSERT INTO bitly.shorten (login, apiKey, longUrl) VALUES ('ME', 'API_KEY', 'http://yahoo.com')

  13. MAKING REQUESTS: UPDATING DATA UPDATE social.profile.status SET status="Using YQL UPDATE” WHERE guid="NJFIDHVPVVISDX7UKED2WHU"

  14. MAKING REQUESTS: DELETING DATA DELETE FROM twittertable WHERE tweetid="12345" AND username="twitter_username" AND password="twitter_password"

  15. MAKING REQUESTS: SUB SELECTS SELECT * FROM geo.places WHERE text IN (SELECT location FROM social.profile WHERE guid = me)

  16. MAKING REQUESTS: THE YQL CONSOLE http://developer.yahoo.com/yql/console

  17. 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"/>

  18. MAKING REQUESTS: FLICKR URLS Photo URL http://farm{$farm}.static.flickr.com/{$server}/{$id }_{$secret}.jpg Photo Page URL http://www.flickr.com/photos/{$owner}/{$id} Photo Owner Profile URL http://www.flickr.com/photos/{$owner}

  19. MAKING REQUESTS: URL STRUCTURE http://query.yahooapis.com/v1/yql?[params] http://query.yahooapis.com/v1/public/yql?[params] Params • q= • format = • diagnostics = [ true / false ] • debug = • callback = [ YQL QUERY ] [ XML / JSON] [ true / false ] [ function name ]

  20. MAKING REQUESTS: PRIVATE DATA http://query.yahooapis.com/v1/yql Uses OAuth 1.0 for authorization OAuth is complicated – use one of our SDKs at https://github.com/yahoo

  21. MAKING REQUESTS: LET’S SEE IT

  22. WHAT WE’RE GOING TO COVER YQL Overview Making Queries and the Console Sandbox Open Data Tables (a.k.a. Adding New Features into YQL) Execute (Server-Side JavaScript) Final Lessons

  23. OPEN DATA TABLES: TOP LEVEL <?xml version="1.0" encoding="UTF-8"?> <table xmlns="http://query.yahooapis.com/v1/schema/t able.xsd"> <meta></meta> <bindings></bindings> </table>

  24. OPEN DATA TABLES: META NODE <?xml version="1.0" encoding="UTF-8"?> <table xmlns="http://query.yahooapis.com/v1/schema/t able.xsd"> <meta></meta> <bindings></bindings> </table>

  25. OPEN DATA TABLES: META NODE <?xml version="1.0" encoding="UTF-8"?> <table xmlns="http://query.yahooapis.com/v1/schema/table.xsd "> <meta> <author>Jonathan LeBlanc</author> <description>My Table</description> <documentationURL>www.site.com </documentationURL> <sampleQuery>SELECT * FROM {table} </sampleQuery> </meta> <bindings></bindings> </table>

  26. OPEN DATA TABLES: BINDINGS NODE <?xml version="1.0" encoding="UTF-8"?> <table xmlns="http://query.yahooapis.com/v1/schema/t able.xsd"> <meta></meta> <bindings></bindings> </table>

  27. OPEN DATA TABLES: BINDINGS NODE <?xml version="1.0" encoding="UTF-8"?> <table xmlns="http://query.yahooapis.com/v1/schema/table.xsd"> <meta></meta> <bindings> <select itemPath="top.child" produces="XML"> <urls> <urlenv="all">http://www.site.com/{user}</url> </urls> <inputs> <key id="user" type="xs:string" paramType="path" required="true" /> </inputs> </select> </bindings> </table>

  28. OPEN DATA TABLES: USING YOUR TABLE Several Choices: 1. Upload the XML file to our community Github account. 2. Upload the XML file to your own site and use the YQL ‘USE’ clause.

  29. OPEN DATA TABLES: COMMUNITY TABLES http://github.com/yql/yql-tables

  30. OPEN DATA TABLES: USING THE USE CLAUSE The USE clause USE 'http://www.mysite.com/my_table.xml' AS mytable; SELECT * FROM mytable WHERE user='john_doe'

  31. WHAT WE’RE GOING TO COVER YQL Overview Making Queries and the Console Sandbox Open Data Tables (a.k.a. Adding New Features into YQL) Execute (Server-Side JavaScript) Final Lessons

  32. EXECUTE: EXECUTE NODE <?xml version="1.0" encoding="UTF-8"?> <table xmlns="http://query.yahooapis.com/v1/schema/table.xsd "> <meta></meta> <bindings> <select itemPath="top.child" produces="XML"> <urls></urls> <inputs></inputs> </select> </bindings> </table>

  33. EXECUTE: EXECUTE NODE <?xml version="1.0" encoding="UTF-8"?> <table xmlns="http://query.yahooapis.com/v1/schema/table.xsd "> <meta></meta> <bindings> <select itemPath="top.child" produces="XML"> <urls></urls> <inputs></inputs> <execute></execute> </select> </bindings> </table>

  34. EXECUTE: SERVER-SIDE JAVASCRIPT <execute> <![CDATA[ //get user specified inputs from YQL query vararrQueries = inputs['query']; //create new XML nodes varelQueries = <queries/>; //output new node as YQL response response.object = elQueries; ]]> </execute>

  35. WHAT WE’RE GOING TO COVER YQL Overview Making Queries and the Console Sandbox Open Data Tables (a.k.a. Adding New Features into YQL) Execute (Server-Side JavaScript) Final Lessons

  36. 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 Execute allows you to manipulate data before it is returned. Use SDKs when accessing private data that requires OAuth

  37. 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

  38. ANY QUESTIONS? http://www.slideshare.net/jclebl anc/hack-day-eu-2011-yql Jonathan LeBlanc Twitter: @jcleblanc E-Mail: jleblanc@yahoo-inc.com

More Related