SlideShare a Scribd company logo
1 of 38
Download to read offline
Standardizing web querying - Using YQL
for accessing and exposing APIs
Agenda
• Introduction to YQL
• How to get started
• What’s supported through YQL
• Theme of the day – mim.yahoo.com
• Lots of examples using mim API
• Mashup using YQL
• Introduction to more YQL goodies
-Server side javascript execution
-YQL hosted storage
• Concluding remarks
..lets keep it interactive
YQL – Yahoo Query Language
• Enables you to access Internet data with SQL-like commands
• YQL hides the complexity of Web service APIs by presenting data as
simple tables, rows, and columns.
• YQL includes pre-defined tables for popular Yahoo! Web services such
as Flickr, Search, Geo and Mim.
• YQL can access services on the Internet that output data in the
following formats: HTML, XML, JSON, RSS, Atom, and microformat.
• Create fast mashups reducing latency, code
How to get started
• Explore the APIs - http://developer.yahoo.com/everything.html
• Get a developer key - https://developer.apps.yahoo.com/wsregapp/
• Read the documentation - http://developer.yahoo.com/yql/guide/
• Visit the YQL Console - http://developer.yahoo.com/yql/console/
-The YQL Console enables you to run YQL statements interactively from your
browser.
• Hack away..
Y! APIs supported by YQL
-Show tables
-Flickr
-Y! geo
-Y! local search
-Y! maps
-Y! mim
-Y! music
-Y! MyBlogLog
-Y! search
-Y! social
-Y! upcoming
External APIs supported by YQL
- Amazon ECS
- AWS
- Bit.ly
- Comicvine
- Craigslist
- Del.icio.us
- Dopplr
- Facebook
- Friendfeed
- Github
- Google (News, Search,
Translate)
- Guardian
- IMDB
- LastFm
- MediaWikiAPI
- Microsoft (Bing)
- Twitter
- Zillow
Through datatables.org
Show tables
Theme of the day – mim.yahoo.com
• Mim has an YQL based API for everything – reading, searching,
updating, deleting and so on.
-Profile information of mim users
-Followers/following information
-Query for users
-Listing mim posts of a user
-Popular posts
-Search for posts
-Inserting (posting to mim) through YQL
 Reposting, commenting deleting
Getting information about self (logged in)
<query xmlns:yahoo="http://www.yahooapis.com/v1/base.rng" yahoo:count="1”
yahoo:lang="en-US”
yahoo:uri="http://query.yahooapis.com/v1/yql?q=select+*+from+meme.info+where+owner_
guid%3Dme">
<results>
<meme>
<guid>NKADUBBZPUQQG6GF6AHTDTABSQ</guid>
<name>shreeni</name>
<title>Shreeni&amp;#39;s Mim</title>
<description/>
<url>http://meme.yahoo.com/shreeni/</url>
<avatar_url>http://a.com/b.jpeg</avatar_url>
<language>en</language>
<followers>18</followers>
</meme>
</results>
</query>
select * from meme.info where owner_guid=me
In JSON
{"query": {
"count": "1", "created": "2009-11-19T10:33:11Z",
"lang": "en-US", "updated": "2009-11-19T10:33:11Z",
"uri":
"http://query.yahooapis.com/v1/yql?q=select+*+from+meme.info+where+owner_guid%3Dm
e",
"results": {
"meme": {
"guid": "NKADUBBZPUQQG6GF6AHTDTABSQ",
"name": "shreeni", "title": "Shreeni&#39;s Mim",
"description": null,
"url": "http://mim.yahoo.com/shreeni/",
"avatar_url":
"http://d.yimg.com/gg/shreeni/avatars/7a0d55f7d0aab9e326a7906a110f8027d46bd49b.jpeg
",
"language": "en", "followers": "18"
}}}}
select * from meme.info where owner_guid=me
How to run YQL queries
•Convert to URL:
http://query.yahooapis.com/v1/public/yql?q=<yql_query>&format=<json/xml>
•Use the YQL Console - http://developer.yahoo.com/yql/console/
•Use a PHP SDK provided by Y! - http://developer.yahoo.com/social/sdk/#php
Selecting specific fields
<results>
<meme>
<title>Shreeni&amp;#39;s Mim</title>
<url>http://mim.yahoo.com/shreeni/</url>
<avatar_url>http://d.yimg.com/gg/shreeni/avatars/7a0d55f7d0aab9e326a7906a11
0f8027d46bd49b.jpeg</avatar_url>
<language>en</language>
</meme>
</results>
select title, url, avatar_url, language from meme.info
where name='shreeni'
Selecting specific fields (also Followers API)
<results>
<meme>
<name>herry</name>
</meme>
<meme>
<name>grahamhills</name>
</meme>
<meme>
<name>fizzycitrus</name>
</meme>
</results>
select name from meme.followers where owner_guid =
“NKADUBBZPUQQG6GF6AHTDTABSQ”
Sub-select and Limits
<results>
<meme>
<name>herry</name>
</meme>
<meme>
<name>grahamhills</name>
</meme>
</results>
select name from meme.followers where owner_guid in
(select guid from meme.info where name='shreeni’)
limit 2
Functions
select name from meme.followers where owner_guid in
(select guid from meme.info where name='shreeni') |
sort(field="name", descending="true”)
Functions
- Sort
- Tail
- Truncate
- Reverse
- unique
- Sanitize
Following API in mim
select name from meme.following where owner_guid in
(select guid from meme.info where
name='bangwinissimo')
Searching for people
select guid, name, title, language from meme.people
where query="Fajar”
select guid, name, title, language from meme.people
where query="Fajar" and language=”id"
Finding specific Posts of a mim user
select * from meme.posts where owner_guid in (select
guid from meme.info where name='bangwinissimo')
select * from meme.posts where owner_guid in (select
guid from meme.info where name='bangwinissimo') and
type='text'
Popular Posts
select * from meme.popular
select * from meme.popular where locale="id"
Search in mim
SELECT * FROM meme.search WHERE query="jakarta”
Inserting/Deleting mim posts
INSERT INTO meme.user.posts (type, content) VALUES
("text", "This is a text post from YQL!”)
DELETE FROM meme.user.posts where pubid = "Nswwwmv"
Reposting, Commenting
INSERT INTO meme.user.posts (guid, pubid, comment)
VALUES ("S5R44PGJRBLKNEE5GYSRQPTXLQ", "rGCOBCK", "this
is the repost comment”)
INSERT INTO meme.user.comments (guid, pubid, comment)
VALUES ("S5R44PGJRBLKNEE5GYSRQPTXLQ", "rGCOBCK", "meme
rocks")
YQL Cheat Sheet
http://bit.ly/yql-cheat-sheet
Exposing own API through YQL
<?xml version="1.0" encoding="UTF-8"?>
<table xmlns="http://query.yahooapis.com/v1/schema/table.xsd">
<meta>
<sampleQuery>select * from {table} where query=’q'</sampleQuery>
</meta>
<bindings>
<select itemPath="results" produces="JSON" >
<urls>
<url env="all">http://query-url</url>
</urls>
<inputs>
<key id=”q" type="xs:string" paramType="query" required="true" />
</inputs>
</select>
</bindings>
</table>
Now access it through YQL
USE "http://definition-file.xml" AS mytable;
SELECT * FROM mytable WHERE query="whatever”
Mashup - introduction
•Finding the Sunrise/Sunset time for Jakarta
•Earthtools api for sunrise-sunset information
•XML based api
•Needs latitude-longitude of the location
•Yahoo Geo API to convert location to latitute-longitude
•Would need 2 different API calls and effort from your side
•Assuming Yahoo API was in JSON would have to deal with 2 formats
Solution – Exposing 3rd party API in YQL
<?xml version="1.0" encoding="UTF-8"?>
<table xmlns="http://query.yahooapis.com/v1/schema/table.xsd">
<meta>
<author>Earthtools.org</author>
<documentationURL>http://www.earthtools.org/</documentationURL>
<sampleQuery>select * from {table} where lat='lat' and lon='lon' and day='day' and
month='month' </sampleQuery>
</meta>
<bindings>
<select itemPath="sun" produces="XML" >
<urls>
<url env="all">http://www.earthtools.org/sun/{lat}/{lon}/{day}/{month}/99/1</url>
</urls>
<inputs>
<key id="lat" type="xs:string" paramType="path" required="true" /><!– 3 others -->
</inputs> </select></bindings> </table>
Querying for the data
# Get the Lat Long information for Jakarta
select * from geo.places where text="Jakarta" limit 1;
# Now get the sunrise/sunset from earthtools using a
# YQL query
USE
"http://rahukalamcalculator.appspot.com/yql/earthtools
-definition.xml" AS earthtools;
SELECT morning, evening FROM earthtools WHERE
lat="1.365580" and lon="103.827713" and day="21" and
month="11”
Combine the queries
# One awesome call!
select * from mytable where (lat,lon) in (select
centroid.latitude, centroid.longitude from geo.places
where text="jakarta") and day="21" and month="11”
Mashup – solution highlights
•Exposed a third party API through YQL
•Expressed business logic in Query – readable, maintainable
•Used server side for the actual join
•Less latency
•Use the format you like
More goodies – YQL server side execution
•Executing JavaScript allows you to use conditional logic and to format data in a
granular manner.
•Better data shaping and parsing
•Better support for calling external Web service
•Better support for adding, modifying, and deleting data using external Web
services
•Lots of examples and detailed documentation at
http://developer.yahoo.com/yql/guide/yql-execute-examples.html
Server Side execution - example
<bindings>
<select itemPath="" produces="XML">
<urls>
…
</inputs>
<execute><![CDATA[
// Your javascript goes here. We will run it on our
servers
response.object = <item>
<url>{request.url}</url>
<a>{a}</a>
<b>{b}</b>
</item>;
]]></execute>
</select>
</bindings>
More goodies – YQL Hosted Storage
•Size Limit: You can have up to 1000 records, with each record being up to
100KB.
•Retention Limit: Records not read, updated, or executed at least once every
thirty days may be removed.
•Record Format: Records must be in a text-based format. Examples include
JavaScript code, XML files, Open Data Tables, or YQL environment files.
•Authentication for New Records: All connections to yql.storage.admin must be
authorized using two-legged OAuth. Alternatively, you can create new records
using the YQL console. However, connections to yql.storage do not require
authentication.
Storing into YQL
# Just the value
insert into yql.storage.admin (value) values ("example text content")
# Contents of a URL
insert into yql.storage.admin (name,url) values
("newrecord","http://hostingdomain.com/mytable.xml")
# response looks like
<results>
<inserted>
<execute>store://35ad2c72-e353-41c4-9d21-4a7e5a1ec92</execute>
<select>store://08fd2c74-d393-48c4-9ee1-3bf7e5a1ec92</select>
<update>store://3cc85a99-6a89-4600-ade1-f7f83ecc4b83</update>
</inserted>
</results>
Querying from hosted storage
# Uses select-id
select * from yql.storage where name="store://08fd2c74”
# Uses update-id
delete from yql.storage where name="store://3cc85a99”
update yql.storage set value="new value" where
name="store://3cc85a99”
# Use contents as env file (uses execute-id)
use "store://35ad2c72" as mytable;
select * from mytable;
# Use contents as JS for server side execute (uses execute-id)
y.include('store://35ad2c72');
response.object = <success>{success}</success>;
Concluding remarks
•YQL is an extensible gateway to use APIs across and beyond Yahoo!
•Allows standardization of APIs across the web
•Familiar and concise language for expressing business and data logic
•Powerful tool to build mashups
•You can build upon existing APIs and expose third party APIs
•Sound server side support, including javascript execution and storage to enable
easy development
Questions?
Thank You!
•http://developer.yahoo.com/yql
•shreeni@yahoo-inc.com
•http://tech.shreeni.info

More Related Content

What's hot

D2W Branding Using jQuery ThemeRoller
D2W Branding Using jQuery ThemeRollerD2W Branding Using jQuery ThemeRoller
D2W Branding Using jQuery ThemeRollerWO Community
 
Plone Interactivity
Plone InteractivityPlone Interactivity
Plone InteractivityEric Steele
 
2022 HTML5: The future is now
2022 HTML5: The future is now2022 HTML5: The future is now
2022 HTML5: The future is nowGonzalo Cordero
 
Web Components v1
Web Components v1Web Components v1
Web Components v1Mike Wilcox
 
Great Responsive-ability Web Design
Great Responsive-ability Web DesignGreat Responsive-ability Web Design
Great Responsive-ability Web DesignMike Wilcox
 
What's this jQuery? Where it came from, and how it will drive innovation
What's this jQuery? Where it came from, and how it will drive innovationWhat's this jQuery? Where it came from, and how it will drive innovation
What's this jQuery? Where it came from, and how it will drive innovationMarakana Inc.
 
Drupal 7 - The Top 40 Core Modules and What They Mean for You
Drupal 7 - The Top 40 Core Modules and What They Mean for YouDrupal 7 - The Top 40 Core Modules and What They Mean for You
Drupal 7 - The Top 40 Core Modules and What They Mean for YouAcquia
 
HTML5, The Open Web, and what it means for you - Altran
HTML5, The Open Web, and what it means for you - AltranHTML5, The Open Web, and what it means for you - Altran
HTML5, The Open Web, and what it means for you - AltranRobert Nyman
 
Angular or Backbone: Go Mobile!
Angular or Backbone: Go Mobile!Angular or Backbone: Go Mobile!
Angular or Backbone: Go Mobile!Doris Chen
 
jQuery (DrupalCamp Toronto)
jQuery (DrupalCamp Toronto)jQuery (DrupalCamp Toronto)
jQuery (DrupalCamp Toronto)jeresig
 
Progressive Downloads and Rendering
Progressive Downloads and RenderingProgressive Downloads and Rendering
Progressive Downloads and RenderingStoyan Stefanov
 
Garfield hs ap cs 2009 - intarwebs
Garfield hs   ap cs 2009 - intarwebsGarfield hs   ap cs 2009 - intarwebs
Garfield hs ap cs 2009 - intarwebsHélène Martin
 
Intro to BackboneJS + Intermediate Javascript
Intro to BackboneJS + Intermediate JavascriptIntro to BackboneJS + Intermediate Javascript
Intro to BackboneJS + Intermediate JavascriptAndrew Lovett-Barron
 
SPSNH 2014 - The SharePoint & jQueryGuide
SPSNH 2014 - The SharePoint & jQueryGuideSPSNH 2014 - The SharePoint & jQueryGuide
SPSNH 2014 - The SharePoint & jQueryGuideMark Rackley
 
Experiences on a Design Approach for Interactive Web Applications
Experiences on a Design Approach for Interactive Web ApplicationsExperiences on a Design Approach for Interactive Web Applications
Experiences on a Design Approach for Interactive Web ApplicationsJanne Kuuskeri
 
2/15/2012 - Wrapping Your Head Around the SharePoint Beast
2/15/2012 - Wrapping Your Head Around the SharePoint Beast2/15/2012 - Wrapping Your Head Around the SharePoint Beast
2/15/2012 - Wrapping Your Head Around the SharePoint BeastMark Rackley
 

What's hot (20)

D2W Branding Using jQuery ThemeRoller
D2W Branding Using jQuery ThemeRollerD2W Branding Using jQuery ThemeRoller
D2W Branding Using jQuery ThemeRoller
 
DirectToWeb 2.0
DirectToWeb 2.0DirectToWeb 2.0
DirectToWeb 2.0
 
Plone Interactivity
Plone InteractivityPlone Interactivity
Plone Interactivity
 
2022 HTML5: The future is now
2022 HTML5: The future is now2022 HTML5: The future is now
2022 HTML5: The future is now
 
Web Components v1
Web Components v1Web Components v1
Web Components v1
 
[2015/2016] Backbone JS
[2015/2016] Backbone JS[2015/2016] Backbone JS
[2015/2016] Backbone JS
 
Why Django for Web Development
Why Django for Web DevelopmentWhy Django for Web Development
Why Django for Web Development
 
Great Responsive-ability Web Design
Great Responsive-ability Web DesignGreat Responsive-ability Web Design
Great Responsive-ability Web Design
 
What's this jQuery? Where it came from, and how it will drive innovation
What's this jQuery? Where it came from, and how it will drive innovationWhat's this jQuery? Where it came from, and how it will drive innovation
What's this jQuery? Where it came from, and how it will drive innovation
 
COScheduler
COSchedulerCOScheduler
COScheduler
 
Drupal 7 - The Top 40 Core Modules and What They Mean for You
Drupal 7 - The Top 40 Core Modules and What They Mean for YouDrupal 7 - The Top 40 Core Modules and What They Mean for You
Drupal 7 - The Top 40 Core Modules and What They Mean for You
 
HTML5, The Open Web, and what it means for you - Altran
HTML5, The Open Web, and what it means for you - AltranHTML5, The Open Web, and what it means for you - Altran
HTML5, The Open Web, and what it means for you - Altran
 
Angular or Backbone: Go Mobile!
Angular or Backbone: Go Mobile!Angular or Backbone: Go Mobile!
Angular or Backbone: Go Mobile!
 
jQuery (DrupalCamp Toronto)
jQuery (DrupalCamp Toronto)jQuery (DrupalCamp Toronto)
jQuery (DrupalCamp Toronto)
 
Progressive Downloads and Rendering
Progressive Downloads and RenderingProgressive Downloads and Rendering
Progressive Downloads and Rendering
 
Garfield hs ap cs 2009 - intarwebs
Garfield hs   ap cs 2009 - intarwebsGarfield hs   ap cs 2009 - intarwebs
Garfield hs ap cs 2009 - intarwebs
 
Intro to BackboneJS + Intermediate Javascript
Intro to BackboneJS + Intermediate JavascriptIntro to BackboneJS + Intermediate Javascript
Intro to BackboneJS + Intermediate Javascript
 
SPSNH 2014 - The SharePoint & jQueryGuide
SPSNH 2014 - The SharePoint & jQueryGuideSPSNH 2014 - The SharePoint & jQueryGuide
SPSNH 2014 - The SharePoint & jQueryGuide
 
Experiences on a Design Approach for Interactive Web Applications
Experiences on a Design Approach for Interactive Web ApplicationsExperiences on a Design Approach for Interactive Web Applications
Experiences on a Design Approach for Interactive Web Applications
 
2/15/2012 - Wrapping Your Head Around the SharePoint Beast
2/15/2012 - Wrapping Your Head Around the SharePoint Beast2/15/2012 - Wrapping Your Head Around the SharePoint Beast
2/15/2012 - Wrapping Your Head Around the SharePoint Beast
 

Similar to SEA Open Hack - YQL

YDN KR Tech Talk : Pipes 와 YQL 활용하기
YDN KR Tech Talk : Pipes 와 YQL 활용하기YDN KR Tech Talk : Pipes 와 YQL 활용하기
YDN KR Tech Talk : Pipes 와 YQL 활용하기Jinho Jung
 
Yui conf nov8-2010-introtoyql
Yui conf nov8-2010-introtoyqlYui conf nov8-2010-introtoyql
Yui conf nov8-2010-introtoyqlmirekgrymuza
 
YQL Publicis Hackday
YQL Publicis HackdayYQL Publicis Hackday
YQL Publicis HackdayPaul Donnelly
 
Oracle Application Express & jQuery Mobile - OGh Apex Dag 2012
Oracle Application Express & jQuery Mobile - OGh Apex Dag 2012Oracle Application Express & jQuery Mobile - OGh Apex Dag 2012
Oracle Application Express & jQuery Mobile - OGh Apex Dag 2012crokitta
 
SharePoint and jQuery Essentials
SharePoint and jQuery EssentialsSharePoint and jQuery Essentials
SharePoint and jQuery EssentialsMark Rackley
 
YQL: Master Of the Mix
YQL: Master Of the MixYQL: Master Of the Mix
YQL: Master Of the Mixmarkandey
 
WebNet Conference 2012 - Designing complex applications using html5 and knock...
WebNet Conference 2012 - Designing complex applications using html5 and knock...WebNet Conference 2012 - Designing complex applications using html5 and knock...
WebNet Conference 2012 - Designing complex applications using html5 and knock...Fabio Franzini
 
Behavior Driven Development and Automation Testing Using Cucumber
Behavior Driven Development and Automation Testing Using CucumberBehavior Driven Development and Automation Testing Using Cucumber
Behavior Driven Development and Automation Testing Using CucumberKMS Technology
 
Liquibase migration for data bases
Liquibase migration for data basesLiquibase migration for data bases
Liquibase migration for data basesRoman Uholnikov
 
TulsaTechFest - Maximize SharePoint UX with free jQuery libraries
TulsaTechFest - Maximize SharePoint UX with free jQuery librariesTulsaTechFest - Maximize SharePoint UX with free jQuery libraries
TulsaTechFest - Maximize SharePoint UX with free jQuery librariesMark Rackley
 
A Quick Introduction to YQL
A Quick Introduction to YQLA Quick Introduction to YQL
A Quick Introduction to YQLMax Manders
 
Simple blog wall creation on Java
Simple blog wall creation on JavaSimple blog wall creation on Java
Simple blog wall creation on JavaMax Titov
 
GitBucket: The perfect Github clone by Scala
GitBucket: The perfect Github clone by ScalaGitBucket: The perfect Github clone by Scala
GitBucket: The perfect Github clone by Scalatakezoe
 
Building Things Fast - and getting approval
Building Things Fast - and getting approvalBuilding Things Fast - and getting approval
Building Things Fast - and getting approvalSimon Willison
 
YQL: Select * from Internet
YQL: Select * from InternetYQL: Select * from Internet
YQL: Select * from Internetdrgath
 
Query the web with YQL
Query the web with YQLQuery the web with YQL
Query the web with YQLramace
 
Rich Portlet Development in uPortal
Rich Portlet Development in uPortalRich Portlet Development in uPortal
Rich Portlet Development in uPortalJennifer Bourey
 

Similar to SEA Open Hack - YQL (20)

YQL & Yahoo! Apis
YQL & Yahoo! ApisYQL & Yahoo! Apis
YQL & Yahoo! Apis
 
YDN KR Tech Talk : Pipes 와 YQL 활용하기
YDN KR Tech Talk : Pipes 와 YQL 활용하기YDN KR Tech Talk : Pipes 와 YQL 활용하기
YDN KR Tech Talk : Pipes 와 YQL 활용하기
 
Yui conf nov8-2010-introtoyql
Yui conf nov8-2010-introtoyqlYui conf nov8-2010-introtoyql
Yui conf nov8-2010-introtoyql
 
YQL Publicis Hackday
YQL Publicis HackdayYQL Publicis Hackday
YQL Publicis Hackday
 
Oracle Application Express & jQuery Mobile - OGh Apex Dag 2012
Oracle Application Express & jQuery Mobile - OGh Apex Dag 2012Oracle Application Express & jQuery Mobile - OGh Apex Dag 2012
Oracle Application Express & jQuery Mobile - OGh Apex Dag 2012
 
SharePoint and jQuery Essentials
SharePoint and jQuery EssentialsSharePoint and jQuery Essentials
SharePoint and jQuery Essentials
 
YQL: Master Of the Mix
YQL: Master Of the MixYQL: Master Of the Mix
YQL: Master Of the Mix
 
WebNet Conference 2012 - Designing complex applications using html5 and knock...
WebNet Conference 2012 - Designing complex applications using html5 and knock...WebNet Conference 2012 - Designing complex applications using html5 and knock...
WebNet Conference 2012 - Designing complex applications using html5 and knock...
 
Behavior Driven Development and Automation Testing Using Cucumber
Behavior Driven Development and Automation Testing Using CucumberBehavior Driven Development and Automation Testing Using Cucumber
Behavior Driven Development and Automation Testing Using Cucumber
 
Introduction to AngularJS
Introduction to AngularJSIntroduction to AngularJS
Introduction to AngularJS
 
Liquibase migration for data bases
Liquibase migration for data basesLiquibase migration for data bases
Liquibase migration for data bases
 
TulsaTechFest - Maximize SharePoint UX with free jQuery libraries
TulsaTechFest - Maximize SharePoint UX with free jQuery librariesTulsaTechFest - Maximize SharePoint UX with free jQuery libraries
TulsaTechFest - Maximize SharePoint UX with free jQuery libraries
 
A Quick Introduction to YQL
A Quick Introduction to YQLA Quick Introduction to YQL
A Quick Introduction to YQL
 
Simple blog wall creation on Java
Simple blog wall creation on JavaSimple blog wall creation on Java
Simple blog wall creation on Java
 
GitBucket: The perfect Github clone by Scala
GitBucket: The perfect Github clone by ScalaGitBucket: The perfect Github clone by Scala
GitBucket: The perfect Github clone by Scala
 
Building Things Fast - and getting approval
Building Things Fast - and getting approvalBuilding Things Fast - and getting approval
Building Things Fast - and getting approval
 
YQL: Select * from Internet
YQL: Select * from InternetYQL: Select * from Internet
YQL: Select * from Internet
 
Yql with geo
Yql with geoYql with geo
Yql with geo
 
Query the web with YQL
Query the web with YQLQuery the web with YQL
Query the web with YQL
 
Rich Portlet Development in uPortal
Rich Portlet Development in uPortalRich Portlet Development in uPortal
Rich Portlet Development in uPortal
 

More from Jonathan LeBlanc

JavaScript App Security: Auth and Identity on the Client
JavaScript App Security: Auth and Identity on the ClientJavaScript App Security: Auth and Identity on the Client
JavaScript App Security: Auth and Identity on the ClientJonathan LeBlanc
 
Improving Developer Onboarding Through Intelligent Data Insights
Improving Developer Onboarding Through Intelligent Data InsightsImproving Developer Onboarding Through Intelligent Data Insights
Improving Developer Onboarding Through Intelligent Data InsightsJonathan LeBlanc
 
Better Data with Machine Learning and Serverless
Better Data with Machine Learning and ServerlessBetter Data with Machine Learning and Serverless
Better Data with Machine Learning and ServerlessJonathan LeBlanc
 
Best Practices for Application Development with Box
Best Practices for Application Development with BoxBest Practices for Application Development with Box
Best Practices for Application Development with BoxJonathan LeBlanc
 
Box Platform Developer Workshop
Box Platform Developer WorkshopBox Platform Developer Workshop
Box Platform Developer WorkshopJonathan LeBlanc
 
Modern Cloud Data Security Practices
Modern Cloud Data Security PracticesModern Cloud Data Security Practices
Modern Cloud Data Security PracticesJonathan LeBlanc
 
Understanding Box UI Elements
Understanding Box UI ElementsUnderstanding Box UI Elements
Understanding Box UI ElementsJonathan LeBlanc
 
Understanding Box applications, tokens, and scoping
Understanding Box applications, tokens, and scopingUnderstanding Box applications, tokens, and scoping
Understanding Box applications, tokens, and scopingJonathan LeBlanc
 
The Future of Online Money: Creating Secure Payments Globally
The Future of Online Money: Creating Secure Payments GloballyThe Future of Online Money: Creating Secure Payments Globally
The Future of Online Money: Creating Secure Payments GloballyJonathan LeBlanc
 
Modern API Security with JSON Web Tokens
Modern API Security with JSON Web TokensModern API Security with JSON Web Tokens
Modern API Security with JSON Web TokensJonathan LeBlanc
 
Creating an In-Aisle Purchasing System from Scratch
Creating an In-Aisle Purchasing System from ScratchCreating an In-Aisle Purchasing System from Scratch
Creating an In-Aisle Purchasing System from ScratchJonathan LeBlanc
 
Secure Payments Over Mixed Communication Media
Secure Payments Over Mixed Communication MediaSecure Payments Over Mixed Communication Media
Secure Payments Over Mixed Communication MediaJonathan LeBlanc
 
Protecting the Future of Mobile Payments
Protecting the Future of Mobile PaymentsProtecting the Future of Mobile Payments
Protecting the Future of Mobile PaymentsJonathan LeBlanc
 
Node.js Authentication and Data Security
Node.js Authentication and Data SecurityNode.js Authentication and Data Security
Node.js Authentication and Data SecurityJonathan LeBlanc
 
PHP Identity and Data Security
PHP Identity and Data SecurityPHP Identity and Data Security
PHP Identity and Data SecurityJonathan LeBlanc
 
Secure Payments Over Mixed Communication Media
Secure Payments Over Mixed Communication MediaSecure Payments Over Mixed Communication Media
Secure Payments Over Mixed Communication MediaJonathan LeBlanc
 
Protecting the Future of Mobile Payments
Protecting the Future of Mobile PaymentsProtecting the Future of Mobile Payments
Protecting the Future of Mobile PaymentsJonathan LeBlanc
 
Future of Identity, Data, and Wearable Security
Future of Identity, Data, and Wearable SecurityFuture of Identity, Data, and Wearable Security
Future of Identity, Data, and Wearable SecurityJonathan LeBlanc
 

More from Jonathan LeBlanc (20)

JavaScript App Security: Auth and Identity on the Client
JavaScript App Security: Auth and Identity on the ClientJavaScript App Security: Auth and Identity on the Client
JavaScript App Security: Auth and Identity on the Client
 
Improving Developer Onboarding Through Intelligent Data Insights
Improving Developer Onboarding Through Intelligent Data InsightsImproving Developer Onboarding Through Intelligent Data Insights
Improving Developer Onboarding Through Intelligent Data Insights
 
Better Data with Machine Learning and Serverless
Better Data with Machine Learning and ServerlessBetter Data with Machine Learning and Serverless
Better Data with Machine Learning and Serverless
 
Best Practices for Application Development with Box
Best Practices for Application Development with BoxBest Practices for Application Development with Box
Best Practices for Application Development with Box
 
Box Platform Overview
Box Platform OverviewBox Platform Overview
Box Platform Overview
 
Box Platform Developer Workshop
Box Platform Developer WorkshopBox Platform Developer Workshop
Box Platform Developer Workshop
 
Modern Cloud Data Security Practices
Modern Cloud Data Security PracticesModern Cloud Data Security Practices
Modern Cloud Data Security Practices
 
Box Authentication Types
Box Authentication TypesBox Authentication Types
Box Authentication Types
 
Understanding Box UI Elements
Understanding Box UI ElementsUnderstanding Box UI Elements
Understanding Box UI Elements
 
Understanding Box applications, tokens, and scoping
Understanding Box applications, tokens, and scopingUnderstanding Box applications, tokens, and scoping
Understanding Box applications, tokens, and scoping
 
The Future of Online Money: Creating Secure Payments Globally
The Future of Online Money: Creating Secure Payments GloballyThe Future of Online Money: Creating Secure Payments Globally
The Future of Online Money: Creating Secure Payments Globally
 
Modern API Security with JSON Web Tokens
Modern API Security with JSON Web TokensModern API Security with JSON Web Tokens
Modern API Security with JSON Web Tokens
 
Creating an In-Aisle Purchasing System from Scratch
Creating an In-Aisle Purchasing System from ScratchCreating an In-Aisle Purchasing System from Scratch
Creating an In-Aisle Purchasing System from Scratch
 
Secure Payments Over Mixed Communication Media
Secure Payments Over Mixed Communication MediaSecure Payments Over Mixed Communication Media
Secure Payments Over Mixed Communication Media
 
Protecting the Future of Mobile Payments
Protecting the Future of Mobile PaymentsProtecting the Future of Mobile Payments
Protecting the Future of Mobile Payments
 
Node.js Authentication and Data Security
Node.js Authentication and Data SecurityNode.js Authentication and Data Security
Node.js Authentication and Data Security
 
PHP Identity and Data Security
PHP Identity and Data SecurityPHP Identity and Data Security
PHP Identity and Data Security
 
Secure Payments Over Mixed Communication Media
Secure Payments Over Mixed Communication MediaSecure Payments Over Mixed Communication Media
Secure Payments Over Mixed Communication Media
 
Protecting the Future of Mobile Payments
Protecting the Future of Mobile PaymentsProtecting the Future of Mobile Payments
Protecting the Future of Mobile Payments
 
Future of Identity, Data, and Wearable Security
Future of Identity, Data, and Wearable SecurityFuture of Identity, Data, and Wearable Security
Future of Identity, Data, and Wearable Security
 

Recently uploaded

Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)Mark Simos
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentPim van der Noll
 
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPathCommunity
 
Microsoft 365 Copilot: How to boost your productivity with AI – Part two: Dat...
Microsoft 365 Copilot: How to boost your productivity with AI – Part two: Dat...Microsoft 365 Copilot: How to boost your productivity with AI – Part two: Dat...
Microsoft 365 Copilot: How to boost your productivity with AI – Part two: Dat...Nikki Chapple
 
Accelerating Enterprise Software Engineering with Platformless
Accelerating Enterprise Software Engineering with PlatformlessAccelerating Enterprise Software Engineering with Platformless
Accelerating Enterprise Software Engineering with PlatformlessWSO2
 
React Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App FrameworkReact Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App FrameworkPixlogix Infotech
 
Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...
Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...
Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...Jeffrey Haguewood
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Alkin Tezuysal
 
Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024TopCSSGallery
 
Kuma Meshes Part I - The basics - A tutorial
Kuma Meshes Part I - The basics - A tutorialKuma Meshes Part I - The basics - A tutorial
Kuma Meshes Part I - The basics - A tutorialJoão Esperancinha
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality AssuranceInflectra
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsRavi Sanghani
 
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Hiroshi SHIBATA
 
A Glance At The Java Performance Toolbox
A Glance At The Java Performance ToolboxA Glance At The Java Performance Toolbox
A Glance At The Java Performance ToolboxAna-Maria Mihalceanu
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityIES VE
 
WomenInAutomation2024: AI and Automation for eveyone
WomenInAutomation2024: AI and Automation for eveyoneWomenInAutomation2024: AI and Automation for eveyone
WomenInAutomation2024: AI and Automation for eveyoneUiPathCommunity
 
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical InfrastructureVarsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructureitnewsafrica
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...Wes McKinney
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesKari Kakkonen
 
Français Patch Tuesday - Avril
Français Patch Tuesday - AvrilFrançais Patch Tuesday - Avril
Français Patch Tuesday - AvrilIvanti
 

Recently uploaded (20)

Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
 
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to Hero
 
Microsoft 365 Copilot: How to boost your productivity with AI – Part two: Dat...
Microsoft 365 Copilot: How to boost your productivity with AI – Part two: Dat...Microsoft 365 Copilot: How to boost your productivity with AI – Part two: Dat...
Microsoft 365 Copilot: How to boost your productivity with AI – Part two: Dat...
 
Accelerating Enterprise Software Engineering with Platformless
Accelerating Enterprise Software Engineering with PlatformlessAccelerating Enterprise Software Engineering with Platformless
Accelerating Enterprise Software Engineering with Platformless
 
React Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App FrameworkReact Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App Framework
 
Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...
Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...
Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
 
Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024
 
Kuma Meshes Part I - The basics - A tutorial
Kuma Meshes Part I - The basics - A tutorialKuma Meshes Part I - The basics - A tutorial
Kuma Meshes Part I - The basics - A tutorial
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and Insights
 
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024
 
A Glance At The Java Performance Toolbox
A Glance At The Java Performance ToolboxA Glance At The Java Performance Toolbox
A Glance At The Java Performance Toolbox
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a reality
 
WomenInAutomation2024: AI and Automation for eveyone
WomenInAutomation2024: AI and Automation for eveyoneWomenInAutomation2024: AI and Automation for eveyone
WomenInAutomation2024: AI and Automation for eveyone
 
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical InfrastructureVarsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examples
 
Français Patch Tuesday - Avril
Français Patch Tuesday - AvrilFrançais Patch Tuesday - Avril
Français Patch Tuesday - Avril
 

SEA Open Hack - YQL

  • 1. Standardizing web querying - Using YQL for accessing and exposing APIs
  • 2. Agenda • Introduction to YQL • How to get started • What’s supported through YQL • Theme of the day – mim.yahoo.com • Lots of examples using mim API • Mashup using YQL • Introduction to more YQL goodies -Server side javascript execution -YQL hosted storage • Concluding remarks ..lets keep it interactive
  • 3. YQL – Yahoo Query Language • Enables you to access Internet data with SQL-like commands • YQL hides the complexity of Web service APIs by presenting data as simple tables, rows, and columns. • YQL includes pre-defined tables for popular Yahoo! Web services such as Flickr, Search, Geo and Mim. • YQL can access services on the Internet that output data in the following formats: HTML, XML, JSON, RSS, Atom, and microformat. • Create fast mashups reducing latency, code
  • 4. How to get started • Explore the APIs - http://developer.yahoo.com/everything.html • Get a developer key - https://developer.apps.yahoo.com/wsregapp/ • Read the documentation - http://developer.yahoo.com/yql/guide/ • Visit the YQL Console - http://developer.yahoo.com/yql/console/ -The YQL Console enables you to run YQL statements interactively from your browser. • Hack away..
  • 5. Y! APIs supported by YQL -Show tables -Flickr -Y! geo -Y! local search -Y! maps -Y! mim -Y! music -Y! MyBlogLog -Y! search -Y! social -Y! upcoming
  • 6. External APIs supported by YQL - Amazon ECS - AWS - Bit.ly - Comicvine - Craigslist - Del.icio.us - Dopplr - Facebook - Friendfeed - Github - Google (News, Search, Translate) - Guardian - IMDB - LastFm - MediaWikiAPI - Microsoft (Bing) - Twitter - Zillow Through datatables.org Show tables
  • 7. Theme of the day – mim.yahoo.com • Mim has an YQL based API for everything – reading, searching, updating, deleting and so on. -Profile information of mim users -Followers/following information -Query for users -Listing mim posts of a user -Popular posts -Search for posts -Inserting (posting to mim) through YQL  Reposting, commenting deleting
  • 8. Getting information about self (logged in) <query xmlns:yahoo="http://www.yahooapis.com/v1/base.rng" yahoo:count="1” yahoo:lang="en-US” yahoo:uri="http://query.yahooapis.com/v1/yql?q=select+*+from+meme.info+where+owner_ guid%3Dme"> <results> <meme> <guid>NKADUBBZPUQQG6GF6AHTDTABSQ</guid> <name>shreeni</name> <title>Shreeni&amp;#39;s Mim</title> <description/> <url>http://meme.yahoo.com/shreeni/</url> <avatar_url>http://a.com/b.jpeg</avatar_url> <language>en</language> <followers>18</followers> </meme> </results> </query> select * from meme.info where owner_guid=me
  • 9. In JSON {"query": { "count": "1", "created": "2009-11-19T10:33:11Z", "lang": "en-US", "updated": "2009-11-19T10:33:11Z", "uri": "http://query.yahooapis.com/v1/yql?q=select+*+from+meme.info+where+owner_guid%3Dm e", "results": { "meme": { "guid": "NKADUBBZPUQQG6GF6AHTDTABSQ", "name": "shreeni", "title": "Shreeni&#39;s Mim", "description": null, "url": "http://mim.yahoo.com/shreeni/", "avatar_url": "http://d.yimg.com/gg/shreeni/avatars/7a0d55f7d0aab9e326a7906a110f8027d46bd49b.jpeg ", "language": "en", "followers": "18" }}}} select * from meme.info where owner_guid=me
  • 10. How to run YQL queries •Convert to URL: http://query.yahooapis.com/v1/public/yql?q=<yql_query>&format=<json/xml> •Use the YQL Console - http://developer.yahoo.com/yql/console/ •Use a PHP SDK provided by Y! - http://developer.yahoo.com/social/sdk/#php
  • 11. Selecting specific fields <results> <meme> <title>Shreeni&amp;#39;s Mim</title> <url>http://mim.yahoo.com/shreeni/</url> <avatar_url>http://d.yimg.com/gg/shreeni/avatars/7a0d55f7d0aab9e326a7906a11 0f8027d46bd49b.jpeg</avatar_url> <language>en</language> </meme> </results> select title, url, avatar_url, language from meme.info where name='shreeni'
  • 12. Selecting specific fields (also Followers API) <results> <meme> <name>herry</name> </meme> <meme> <name>grahamhills</name> </meme> <meme> <name>fizzycitrus</name> </meme> </results> select name from meme.followers where owner_guid = “NKADUBBZPUQQG6GF6AHTDTABSQ”
  • 13. Sub-select and Limits <results> <meme> <name>herry</name> </meme> <meme> <name>grahamhills</name> </meme> </results> select name from meme.followers where owner_guid in (select guid from meme.info where name='shreeni’) limit 2
  • 14. Functions select name from meme.followers where owner_guid in (select guid from meme.info where name='shreeni') | sort(field="name", descending="true”)
  • 15. Functions - Sort - Tail - Truncate - Reverse - unique - Sanitize
  • 16. Following API in mim select name from meme.following where owner_guid in (select guid from meme.info where name='bangwinissimo')
  • 17. Searching for people select guid, name, title, language from meme.people where query="Fajar” select guid, name, title, language from meme.people where query="Fajar" and language=”id"
  • 18. Finding specific Posts of a mim user select * from meme.posts where owner_guid in (select guid from meme.info where name='bangwinissimo') select * from meme.posts where owner_guid in (select guid from meme.info where name='bangwinissimo') and type='text'
  • 19. Popular Posts select * from meme.popular select * from meme.popular where locale="id"
  • 20. Search in mim SELECT * FROM meme.search WHERE query="jakarta”
  • 21. Inserting/Deleting mim posts INSERT INTO meme.user.posts (type, content) VALUES ("text", "This is a text post from YQL!”) DELETE FROM meme.user.posts where pubid = "Nswwwmv"
  • 22. Reposting, Commenting INSERT INTO meme.user.posts (guid, pubid, comment) VALUES ("S5R44PGJRBLKNEE5GYSRQPTXLQ", "rGCOBCK", "this is the repost comment”) INSERT INTO meme.user.comments (guid, pubid, comment) VALUES ("S5R44PGJRBLKNEE5GYSRQPTXLQ", "rGCOBCK", "meme rocks")
  • 24. Exposing own API through YQL <?xml version="1.0" encoding="UTF-8"?> <table xmlns="http://query.yahooapis.com/v1/schema/table.xsd"> <meta> <sampleQuery>select * from {table} where query=’q'</sampleQuery> </meta> <bindings> <select itemPath="results" produces="JSON" > <urls> <url env="all">http://query-url</url> </urls> <inputs> <key id=”q" type="xs:string" paramType="query" required="true" /> </inputs> </select> </bindings> </table>
  • 25. Now access it through YQL USE "http://definition-file.xml" AS mytable; SELECT * FROM mytable WHERE query="whatever”
  • 26. Mashup - introduction •Finding the Sunrise/Sunset time for Jakarta •Earthtools api for sunrise-sunset information •XML based api •Needs latitude-longitude of the location •Yahoo Geo API to convert location to latitute-longitude •Would need 2 different API calls and effort from your side •Assuming Yahoo API was in JSON would have to deal with 2 formats
  • 27. Solution – Exposing 3rd party API in YQL <?xml version="1.0" encoding="UTF-8"?> <table xmlns="http://query.yahooapis.com/v1/schema/table.xsd"> <meta> <author>Earthtools.org</author> <documentationURL>http://www.earthtools.org/</documentationURL> <sampleQuery>select * from {table} where lat='lat' and lon='lon' and day='day' and month='month' </sampleQuery> </meta> <bindings> <select itemPath="sun" produces="XML" > <urls> <url env="all">http://www.earthtools.org/sun/{lat}/{lon}/{day}/{month}/99/1</url> </urls> <inputs> <key id="lat" type="xs:string" paramType="path" required="true" /><!– 3 others --> </inputs> </select></bindings> </table>
  • 28. Querying for the data # Get the Lat Long information for Jakarta select * from geo.places where text="Jakarta" limit 1; # Now get the sunrise/sunset from earthtools using a # YQL query USE "http://rahukalamcalculator.appspot.com/yql/earthtools -definition.xml" AS earthtools; SELECT morning, evening FROM earthtools WHERE lat="1.365580" and lon="103.827713" and day="21" and month="11”
  • 29. Combine the queries # One awesome call! select * from mytable where (lat,lon) in (select centroid.latitude, centroid.longitude from geo.places where text="jakarta") and day="21" and month="11”
  • 30. Mashup – solution highlights •Exposed a third party API through YQL •Expressed business logic in Query – readable, maintainable •Used server side for the actual join •Less latency •Use the format you like
  • 31. More goodies – YQL server side execution •Executing JavaScript allows you to use conditional logic and to format data in a granular manner. •Better data shaping and parsing •Better support for calling external Web service •Better support for adding, modifying, and deleting data using external Web services •Lots of examples and detailed documentation at http://developer.yahoo.com/yql/guide/yql-execute-examples.html
  • 32. Server Side execution - example <bindings> <select itemPath="" produces="XML"> <urls> … </inputs> <execute><![CDATA[ // Your javascript goes here. We will run it on our servers response.object = <item> <url>{request.url}</url> <a>{a}</a> <b>{b}</b> </item>; ]]></execute> </select> </bindings>
  • 33. More goodies – YQL Hosted Storage •Size Limit: You can have up to 1000 records, with each record being up to 100KB. •Retention Limit: Records not read, updated, or executed at least once every thirty days may be removed. •Record Format: Records must be in a text-based format. Examples include JavaScript code, XML files, Open Data Tables, or YQL environment files. •Authentication for New Records: All connections to yql.storage.admin must be authorized using two-legged OAuth. Alternatively, you can create new records using the YQL console. However, connections to yql.storage do not require authentication.
  • 34. Storing into YQL # Just the value insert into yql.storage.admin (value) values ("example text content") # Contents of a URL insert into yql.storage.admin (name,url) values ("newrecord","http://hostingdomain.com/mytable.xml") # response looks like <results> <inserted> <execute>store://35ad2c72-e353-41c4-9d21-4a7e5a1ec92</execute> <select>store://08fd2c74-d393-48c4-9ee1-3bf7e5a1ec92</select> <update>store://3cc85a99-6a89-4600-ade1-f7f83ecc4b83</update> </inserted> </results>
  • 35. Querying from hosted storage # Uses select-id select * from yql.storage where name="store://08fd2c74” # Uses update-id delete from yql.storage where name="store://3cc85a99” update yql.storage set value="new value" where name="store://3cc85a99” # Use contents as env file (uses execute-id) use "store://35ad2c72" as mytable; select * from mytable; # Use contents as JS for server side execute (uses execute-id) y.include('store://35ad2c72'); response.object = <success>{success}</success>;
  • 36. Concluding remarks •YQL is an extensible gateway to use APIs across and beyond Yahoo! •Allows standardization of APIs across the web •Familiar and concise language for expressing business and data logic •Powerful tool to build mashups •You can build upon existing APIs and expose third party APIs •Sound server side support, including javascript execution and storage to enable easy development