340 likes | 354 Views
Presentation on "Building Adaptive Payment Systems using YQL" presented at PayPal X Innovate 2010
E N D
Constructing "SELECT * Constructing "SELECT * FROM Internet" Payment FROM Internet" Payment Tools Tools Using the Yahoo! Query Language
What We’ll Learn 1. Delivering Upsell Content from YQL Data Sources 1. Driving Traffic Back to Your Services with Open Data Tables 1. Mashing up Multiple Data Sources with Server-Side JavaScript 3
Making Queries SELECT * FROM Internet 6
YQL Test Console Available At: http://developer.yahoo.com/yql/console 7
Running Queries - SELECT Query Structure SELECT myColumn, myTitle FROM myTable(0, 50) WHERE myColumn = 'value' AND myTitle = 'title' LIMIT 3 OFFSET 10 | sort(field='myColumn') | reverse() 8
Running Queries - INSERT / UPDATE / DELETE Modify Data on the Internet Create Tweets, Add Blog Entries, Update Databases Current Tables Using I/U/D Twitter Status, bit.ly URL Shortner, Yahoo! Profile Status / Update Stream, Amazon SimpleDB 9
Running Queries – Sub-selects with the IN clause SELECT * FROM flickr.photos.search WHERE (lat, lon) IN (SELECT centroid.latitude, centroid.longitude FROM geo.places WHERE text="SFO") 10
Running Queries – Available Tables YQL Command: SHOW Tables Number of Standard Tables: 169 Number of Community Tables: 771 Total Number of Tables: 940 Contribute Tables to: http://www.github.com/yql/yql-tables/ 11
Running Queries – Table Syntax YQL Command: DESC tablename 12
Running Queries – URL Format http://query.yahooapis.com/v1/yql?[params] http://query.yahooapis.com/v1/public/yql?[params] Params • q=[QUERY] • format=[XML / JSON] • diagnostics=[true / false] • debug=[true / false] • callback=[function name] 13
Running Queries – URL Format http://query.yahooapis.com/v1/yql?[params] http://query.yahooapis.com/v1/public/yql?[params] Params • q=[QUERY] • format=[XML / JSON / JSONP / JSONP-X] • diagnostics=[true / false] • debug=[true / false] • callback=[function name] 14
YQL Open Data Tables Wrap Your Own API or Data Source 16
Open Data Tables – XML File Syntax <?xml version="1.0" encoding="UTF-8"?> <table xmlns="http://query.yahooapis.com/v1/schema/table.xsd"> <meta></meta> <bindings></bindings> </table> 17
Open Data Tables – XML File Syntax <?xml version="1.0" encoding="UTF-8"?> <table xmlns="http://query.yahooapis.com/v1/schema/table.xsd"> <meta></meta> <bindings></bindings> </table> 18
Open Data Tables – XML File Syntax <?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> 19
Open Data Tables – XML File Syntax <?xml version="1.0" encoding="UTF-8"?> <table xmlns="http://query.yahooapis.com/v1/schema/table.xsd"> <meta></meta> <bindings></bindings> </table> 20
Open Data Tables – XML File Syntax <table xmlns="http://query.yahooapis.com/v1/schema/table.xsd"> <meta></meta> <bindings> <select itemPath="" produces="XML" > <urls> <url env="all”>http://www.site.com/{user}</url> </urls> <inputs> <key id="user" type="xs:string" paramType="path" required="true" /> </inputs> </select> </bindings> </table> 21
Open Data Tables – Invoking a Table Definition The USE clause USE "http://alavilli.com/yql/paypal_txn_table.xml" AS paypal_txn_table; SELECT * FROM paypal_txn_table WHERE StartDate="2010-06-12T00:00:00.000Z" AND APIUsername="xxx" AND APIPassword="xxx" AND Signature="xxx" 22
New PayPal Tables! Available At: http://github.com/yql/yql-tables Transaction Search: paypal/paypal.transaction.xml Transaction Details: paypal/paypal.transactions.details 23
Mapping Social Data to Products Location Regional Products Product Suggestions Interests Specialty Merchandise Profession Suggest to Friends Friends Birthday / Anniversary Seasonal / Targeted Products 25
YQL Execute Extending Open Data Tables 26
YQL Execute – XML File Syntax Augment data Collect geographic data based on a free-form text location Create APIs from web pages Build your very own ScrAPI Data Transformations Convert the results from xml to Google's kml format Move business logic of your application to the cloud 27
YQL Execute – XML File Syntax <?xml version="1.0" encoding="UTF-8"?> <table xmlns="http://query.yahooapis.com/v1/schema/table.xsd"> <meta></meta> <bindings> <select itemPath="" produces="XML" > <urls></urls> <inputs></inputs> </select> </bindings> </table> 28
YQL Execute – XML File Syntax <?xml version="1.0" encoding="UTF-8"?> <table xmlns="http://query.yahooapis.com/v1/schema/table.xsd"> <meta></meta> <bindings> <select itemPath="" produces="XML" > <urls></urls> <inputs></inputs> <execute></execute> </select> </bindings> </table> 29
YQL Execute – XML File Syntax <execute> <![CDATA[ var arrQueries = inputs['query'].split('|'); var elQueries = <queries/>; . . . ]]> </execute> 30
Global Disaster Alert and Coordination System Table Available At: http://github.com/yql/yql-tables Under gdacs/gdacs.current.xml 31
Conclusion Build adaptive applications faster (and that run faster) 32
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 33
Thank You Questions? 34