YQL Case Study

Allan Huang @ esobi Inc.
Agenda


YQL




PlaceFinder API




Case Study - Stock Quote
Case Study - City WOEID

Flickr API






Case Study - City WOEID
Case Study - City Photo
Case Study - Area Photo
Case Study - Photo Information
Case Study - Photo EXIF
Continued Agenda


Instagram API





Case Study - Area Photo
Case Study - Popular Photo
Case Study - Recent Tagged Photo
Case Study - Location Search
Yahoo Query Language
YQL - Yahoo Query Language
Flickr

Yahoo
BOSS Geo
YQL in HTTP

s
es
c
Ac

Yahoo
Weather

Web
Service

Access

XML | JSON

CSV
HTML

Ac
ce
ss

JSON
XML

Yahoo
Finance

Instagram
RSS
YQL Usage Information






For commercial purposes
At least 6 months notice on YDN
Uptime target of over 99.5%
Register an API Key with Yahoo
YQL Console
YQL Statements
YQL Console
Case Study - Stock Quote






USE "http://www.datatables.org/yahoo/finance/yahoo.finance.quotes.xml" as
stock_quotes;
SELECT Symbol, Name, Open, DaysHigh, DaysLow, LastTradePriceOnly,
ChangeinPercent FROM stock_quotes where symbol in ("^DJI", "^IXIC", "^SPX",
"^SOX", "^N225", "^HSI", "^TWII", "YHOO", "AAPL", "GOOG", "IBM", "MSFT", "TSM",
"2330.TW", "2353.TW")
Familiar with JSON / XML
Dow Jones Index Issue


Why can't I download data from the Dow
Jones Index?






Yahoo! is no longer licensed to provide data
downloads for the Dow Jones Index.
Dow Jones Industrial Average [^DJI] data can
only be viewed on the screen.
Yahoo! Help
Yahoo Finance Lookup Symbol
Yahoo Stock Lookup Service





http://autoc.finance.yahoo.com/aut
oc?
query=Apple&callback=YAHOO.Fi
nance.SymbolSuggest.ssCallback
Familiar with JSON format
Symbol Lookup from Yahoo
Finance
PlaceFinder API
PlaceFinder API Usage Information






Yahoo BOSS Geo service
 RESTful Geocoding Web service
Currently supports 10 languages
 en, fr, de, it, es, pt, nl, zh (tw / cn), ja, ko
WOEID
 Where On Earth IDentifier
Case Study – City WOEID



SELECT city, woeid FROM geo.placefinder where text= "Taipei"
Familiar with JSON / XML
Flickr API
Flickr API Usage Information


Before using Flickr API


Get you API Key






Get api_key

Put your app in the Flickr App Garden

Limitations






Your application must stay under 3600 queries
per hour across the whole key
Your application can cache API results and
images for up to 24 hours
Flickr API Explorer
Case Study – City WOEID




SELECT woe_name, woeid FROM flickr.places where
api_key="???" and query="Taipei" and place_type_id="7"
Familiar with JSON / XML
Case Study - City Photo




SELECT * FROM flickr.photos.search(50) where api_key="???" and
tags="view, scenery, scene, landscape" and content_type="1" and
sort="interestingness-desc" and weoid="2306179"
Familiar with JSON / XML
Case Study - Area Photo




SELECT * FROM flickr.photos.search(50) where api_key="???" and
tags="view, scenery, scene, landscape" and content_type="1" and
sort="interestingness-desc" and lat="25.0259641" and lon="121.5293006"
and radius="32"
Familiar with JSON / XML
Case Study - Photo Information




SELECT * FROM flickr.photos.info where api_key="???" and
photo_id="3855224197" and secret="4ac2a27833"
Familiar with JSON / XML
Case Study - Photo EXIF




SELECT * FROM flickr.photos.exif where api_key="???" and
photo_id="3855224197"
Familiar with JSON / XML
Flickr Photo URL


Photo Source URL


http://farm{farm-id}.staticflickr.com/{server-id}/{id}_{secret}.jpg
http://farm{farm-id}.staticflickr.com/{server-id}/
{id}_{secret}_[mstzb].jpg



Size Suffixes








s, q, t, m, n, z, b
except -, c, o

Individual Photo URL



http://www.flickr.com/photos/{owner-id}/{photo-id}
http://flickr.com/photo.gne?id={photo-id}
Instagram API
Instagram API Usage Information


Before using Instagran API


Register Your Application




Get client_id and client_secret

Limitations




Your application are limited to 5000 requests per
hour per client_id or access_token
Apigee API Console For Instagram
Case Study – Area Photo




SELECT data.link, data.images, data.caption FROM json where
url='https://api.instagram.com/v1/media/search?
lat=25.02597094&lng=121.5292736&distance=5000&client_id=???'
Familiar with JSON
Case Study – Popular Photo




SELECT data.link, data.images, data.caption FROM json where
url='https://api.instagram.com/v1/media/popular?client_id=???'
Familiar with JSON
Case Study – Recent Tagged Photo




SELECT data.link, data.images, data.caption FROM json where
url='https://api.instagram.com/v1/tags/spring/media/recent?client_id=???'
Familiar with JSON
Case Study – Location Search




SELECT data FROM json where
url='https://api.instagram.com/v1/locations/search?
lat=25.02597094&lng=121.5292736&distance=5000&client_id=???'
Familiar with JSON
Instagram Photo URL


Photo Source URL


images.standard_resolution.url attribute




images.low_resolution.url attribute




width 306px, height 306px

images.thumbnail.url attribute




width 612px, height 612px

width 150px, height 150px

Individual Photo URL


data.link attribute
Reference








YQL Usage Information
 Register an API Key with Yahoo
Yahoo BOSS - Pricing
 PlaceFinder FAQ
What is Flickr App Garden?
 Flickr Developer Guide
 Flickr Place Find
 Flickr Photo Search
 Flickr Photo GetInfo
 Flickr Photo GetExif
 Photo Source URLs
Instagram Developer Documentation
 Instagram Authentication
 Instagram API Endpoints
Q&A

YQL Case Study

  • 1.
    YQL Case Study AllanHuang @ esobi Inc.
  • 2.
    Agenda  YQL   PlaceFinder API   Case Study- Stock Quote Case Study - City WOEID Flickr API      Case Study - City WOEID Case Study - City Photo Case Study - Area Photo Case Study - Photo Information Case Study - Photo EXIF
  • 3.
    Continued Agenda  Instagram API     CaseStudy - Area Photo Case Study - Popular Photo Case Study - Recent Tagged Photo Case Study - Location Search
  • 4.
  • 5.
    YQL - YahooQuery Language Flickr Yahoo BOSS Geo YQL in HTTP s es c Ac Yahoo Weather Web Service Access XML | JSON CSV HTML Ac ce ss JSON XML Yahoo Finance Instagram RSS
  • 6.
    YQL Usage Information      Forcommercial purposes At least 6 months notice on YDN Uptime target of over 99.5% Register an API Key with Yahoo YQL Console
  • 7.
  • 8.
  • 9.
    Case Study -Stock Quote    USE "http://www.datatables.org/yahoo/finance/yahoo.finance.quotes.xml" as stock_quotes; SELECT Symbol, Name, Open, DaysHigh, DaysLow, LastTradePriceOnly, ChangeinPercent FROM stock_quotes where symbol in ("^DJI", "^IXIC", "^SPX", "^SOX", "^N225", "^HSI", "^TWII", "YHOO", "AAPL", "GOOG", "IBM", "MSFT", "TSM", "2330.TW", "2353.TW") Familiar with JSON / XML
  • 10.
    Dow Jones IndexIssue  Why can't I download data from the Dow Jones Index?    Yahoo! is no longer licensed to provide data downloads for the Dow Jones Index. Dow Jones Industrial Average [^DJI] data can only be viewed on the screen. Yahoo! Help
  • 11.
  • 12.
    Yahoo Stock LookupService    http://autoc.finance.yahoo.com/aut oc? query=Apple&callback=YAHOO.Fi nance.SymbolSuggest.ssCallback Familiar with JSON format Symbol Lookup from Yahoo Finance
  • 13.
  • 14.
    PlaceFinder API UsageInformation    Yahoo BOSS Geo service  RESTful Geocoding Web service Currently supports 10 languages  en, fr, de, it, es, pt, nl, zh (tw / cn), ja, ko WOEID  Where On Earth IDentifier
  • 15.
    Case Study –City WOEID   SELECT city, woeid FROM geo.placefinder where text= "Taipei" Familiar with JSON / XML
  • 16.
  • 17.
    Flickr API UsageInformation  Before using Flickr API  Get you API Key    Get api_key Put your app in the Flickr App Garden Limitations    Your application must stay under 3600 queries per hour across the whole key Your application can cache API results and images for up to 24 hours Flickr API Explorer
  • 18.
    Case Study –City WOEID   SELECT woe_name, woeid FROM flickr.places where api_key="???" and query="Taipei" and place_type_id="7" Familiar with JSON / XML
  • 19.
    Case Study -City Photo   SELECT * FROM flickr.photos.search(50) where api_key="???" and tags="view, scenery, scene, landscape" and content_type="1" and sort="interestingness-desc" and weoid="2306179" Familiar with JSON / XML
  • 20.
    Case Study -Area Photo   SELECT * FROM flickr.photos.search(50) where api_key="???" and tags="view, scenery, scene, landscape" and content_type="1" and sort="interestingness-desc" and lat="25.0259641" and lon="121.5293006" and radius="32" Familiar with JSON / XML
  • 21.
    Case Study -Photo Information   SELECT * FROM flickr.photos.info where api_key="???" and photo_id="3855224197" and secret="4ac2a27833" Familiar with JSON / XML
  • 22.
    Case Study -Photo EXIF   SELECT * FROM flickr.photos.exif where api_key="???" and photo_id="3855224197" Familiar with JSON / XML
  • 23.
    Flickr Photo URL  PhotoSource URL  http://farm{farm-id}.staticflickr.com/{server-id}/{id}_{secret}.jpg http://farm{farm-id}.staticflickr.com/{server-id}/ {id}_{secret}_[mstzb].jpg  Size Suffixes     s, q, t, m, n, z, b except -, c, o Individual Photo URL   http://www.flickr.com/photos/{owner-id}/{photo-id} http://flickr.com/photo.gne?id={photo-id}
  • 24.
  • 25.
    Instagram API UsageInformation  Before using Instagran API  Register Your Application   Get client_id and client_secret Limitations   Your application are limited to 5000 requests per hour per client_id or access_token Apigee API Console For Instagram
  • 26.
    Case Study –Area Photo   SELECT data.link, data.images, data.caption FROM json where url='https://api.instagram.com/v1/media/search? lat=25.02597094&lng=121.5292736&distance=5000&client_id=???' Familiar with JSON
  • 27.
    Case Study –Popular Photo   SELECT data.link, data.images, data.caption FROM json where url='https://api.instagram.com/v1/media/popular?client_id=???' Familiar with JSON
  • 28.
    Case Study –Recent Tagged Photo   SELECT data.link, data.images, data.caption FROM json where url='https://api.instagram.com/v1/tags/spring/media/recent?client_id=???' Familiar with JSON
  • 29.
    Case Study –Location Search   SELECT data FROM json where url='https://api.instagram.com/v1/locations/search? lat=25.02597094&lng=121.5292736&distance=5000&client_id=???' Familiar with JSON
  • 30.
    Instagram Photo URL  PhotoSource URL  images.standard_resolution.url attribute   images.low_resolution.url attribute   width 306px, height 306px images.thumbnail.url attribute   width 612px, height 612px width 150px, height 150px Individual Photo URL  data.link attribute
  • 31.
    Reference     YQL Usage Information Register an API Key with Yahoo Yahoo BOSS - Pricing  PlaceFinder FAQ What is Flickr App Garden?  Flickr Developer Guide  Flickr Place Find  Flickr Photo Search  Flickr Photo GetInfo  Flickr Photo GetExif  Photo Source URLs Instagram Developer Documentation  Instagram Authentication  Instagram API Endpoints
  • 32.