fowa 09 - open strategy applied

16
Open Strategy :: Applied Dan Theurer – Yahoo! Developer Network FOWA, Miami

Upload: dan-theurer

Post on 18-May-2015

1.293 views

Category:

Technology


0 download

DESCRIPTION

Overview of Yahoo! Developer Network and how the Open Strategy benefits developers and the web. Quick YQL overview with code samples.

TRANSCRIPT

Page 1: FOWA 09 - Open Strategy Applied

Open Strategy :: AppliedDan Theurer – Yahoo! Developer Network

FOWA, Miami

Page 2: FOWA 09 - Open Strategy Applied

2

Yahoo Developer Network (YDN)

• Open Source

• Developer Tools

• Data Services

Yahoo! Open Strategy (YOS)

YQL Code Samples

Open Strategy :: Applied

Page 3: FOWA 09 - Open Strategy Applied

3

• YUI

• Hadoop

• Apache

• PHP

• Perl

• MySQL

YDN :: Open Source

Page 4: FOWA 09 - Open Strategy Applied

4

• YSlow

• Pipes

• Blueprint Mobile Widgets

YDN :: Developer Tools

Page 5: FOWA 09 - Open Strategy Applied

5

• BOSS

• Address Book

• Flickr

YDN :: Data Services

Page 6: FOWA 09 - Open Strategy Applied

6

YOS :: Technology Stack

Page 7: FOWA 09 - Open Strategy Applied

7

• SQL-like syntax

• Allows you to query (SELECT), filter

(WHERE) and join (IN) data across

WebServices.

• Self Describing - SHOW, DESC table

• Public / Private Data

• Bindings for many YDN APIs

• Can query external structured data (USE)

• http://developer.yahoo.com/yql

Yahoo! Query Language (YQL)

Page 8: FOWA 09 - Open Strategy Applied

8

<query yahoo:count="46" yahoo:created="2009-02-20T08:16:03Z" yahoo:lang="en-US" yahoo:updated="2009-02-20T08:16:03Z" yahoo:uri="http://query.yahooapis.com/v1/yql?q=show+tables"> <results> <table>atom</table> <table>csv</table> <table>feed</table> <table>flickr.photos.exif</table> <table>flickr.photos.info</table> <table>flickr.photos.interestingness</table> <table>flickr.photos.recent</table> <table>flickr.photos.search</table> <table>flickr.photos.sizes</table> <table>flickr.places</table> <table>flickr.places.info</table> <table>geo.places</table> <table>geo.places.ancestors</table> … </results></query

YQL :: SHOW tables

Page 9: FOWA 09 - Open Strategy Applied

9

<query yahoo:count="1" yahoo:created="2009-02-21T01:41:28Z" yahoo:lang="en-US" yahoo:updated="2009-02-21T01:41:28Z" yahoo:uri="http://query.yahooapis.com/v1/yql?q=desc+flickr.photos.search"> <results> <table name="flickr.photos.search”> <request> <select usesRemoteLimit="true”> <key name="machine_tags" type="xs:string"/> <key name="radius_units" type="xs:string"/> <key name="safe_search" type="xs:string"/> <key name="privacy_filter" type="xs:string"/> <key name="contacts" type="xs:string"/> <key name="tags" type="xs:string"/> <key name="place_id" type="xs:string"/> <key name="text" type="xs:string"/> … </select> </request> </table> </results></query>

YQL :: DESC flickr.photos.search

Page 10: FOWA 09 - Open Strategy Applied

10

<query yahoo:count="6" yahoo:created="2009-02-21T02:09:55Z" yahoo:lang="en-US" yahoo:updated="2009-02-21T02:09:55Z" yahoo:uri="http://query.yahooapis.com/v1/yql?q=select+*+from+flickr.photos.search+where+user_id%3D%2228569531%40N00%22+and+text%3D%22jump%22+limit+6"> <results> <photo farm="4" id="3154107557" isfamily="0" isfriend="0" ispublic="1" owner="28569531@N00" secret="6f22e677c3" server="3101" title="Jump - Fremont Older"/> <photo farm="4" id="2563123589" isfamily="0" isfriend="0" ispublic="1" owner="28569531@N00" secret="7811c91934" server="3087" title="Jump"/> <photo farm="3" id="2159479534" isfamily="0" isfriend="0" ispublic="1" owner="28569531@N00" secret="785e671cd4" server="2080" title="Hollywood - Jump - Dan"/> <photo farm="3" id="2066431773" isfamily="0" isfriend="0" ispublic="1" owner="28569531@N00" secret="c61604d090" server="2208" title="JUMP!"/> <photo farm="2" id="1304849768" isfamily="0" isfriend="0" ispublic="1" owner="28569531@N00" secret="7271c8f9b3" server="1233" title="Testing the suit"/> <photo farm="2" id="1178261094" isfamily="0" isfriend="0" ispublic="1" owner="28569531@N00" secret="3dac28807f" server="1241" title="Jump, jump!"/> </results></query>

YQL ::SELECT * FROM flickr.photos.search WHERE user_id="28569531@N00” AND text="jump” LIMIT 6

Page 11: FOWA 09 - Open Strategy Applied

11

1. Download the SDK

http://developer.yahoo.com/social/sdk

2. Unzip yos_php_sdk-1.1

3. Get a Developer Key

http://developer.yahoo.com/dashboard

4. Start to write some code

Developer Key / PHP SDK

Page 12: FOWA 09 - Open Strategy Applied

12

<?php// Include the PHP SDK for YSP library.require_once("yosdk/lib/Yahoo.inc");

// Define values for keys required for authorizationdefine(CONSUMER_KEY,"dj0yJmk9ZDNwaXdQSEZ…j");define(CONSUMER_SECRET,"37fe717538e0598e6c70d4262…");

// The YahooApplication class is used for two-legged authorization, which doesn't need user authorization.$two_legged_app = new YahooApplication(CONSUMER_KEY,CONSUMER_SECRET);

// Create queries for Flickr$yql_request = 'select * from flickr.photos.search where user_id="28569531@N00" and text="jump" limit 6';

// Make the request$results = $two_legged_app->query($yql_request);$photos = $results->query->results->photo;

// Build the output HTMLforeach($photos as $k=>$v) { $imgs .= '<img src="http://farm' . $v->farm . '.static.flickr.com/' . $v->server . '/' . $v->id . '_' . $v->secret . '_m.jpg" alt="Image' . $k . '"/>' ;}echo "<html><body>" . $imgs . '</body></html>’;?>

YQL :: 2-legged OAuth – PHP SDK

Page 13: FOWA 09 - Open Strategy Applied

13

YQL :: 2-legged OAuth – Result

Page 14: FOWA 09 - Open Strategy Applied

14

<?php// Include the PHP SDK for YSP library.require_once("yosdk/lib/Yahoo.inc");

// Define values for keys required for authorizationdefine(CONSUMER_KEY,"dj0yJmk9ZDNwaXd…j");define(CONSUMER_SECRET,"37fe717538e0598e6…");

$session=YahooSession::requireSession(CONSUMER_KEY,CONSUMER_SECRET);

// Define YQL queries for the Social Directory APIs$query = "SELECT * FROM social.connections WHERE owner_guid=me LIMIT 2";$result = $session->query($query);

// Build the output HTMLecho("<html><body><pre><h2>Connection Data</h2>" );var_dump($result) ;echo("</pre></body></html>");?>

YQL :: 3-legged OAuth – PHP SDK

Page 15: FOWA 09 - Open Strategy Applied

15

YQL :: 3-legged OAuth – Result

Page 16: FOWA 09 - Open Strategy Applied

16

Thank You

[email protected]