Yahoo Social SDKs<br />Jon LeBlanc + Dustin Whittle<br />Yahoo! Developer Network<br />
EXAMPLES | TUTORIALS | CODE SAMPLES<br />developer.yahoo.com<br />
Open applications are applications that run on the Yahoo! network: Yahoo! Homepage and My Yahoo!<br />OAuth applications a...
SDK Prerequisites  <br /><ul><li>ck  = CONSUMER_KEY
cks = CONSUMER_SECRET
app = APPLICATION_ID
cb  = CALLBACK_URL</li></li></ul><li>
SDK Code DiveWhat can you do?<br />11<br />
Yahoo! Social Apps – A good foundation<br />Scalable Hosting<br />Joyent – Free OpenSocial Accelerators<br />Google App En...
What SDK Languages Are Available?<br />PHP, Python, Java, ActionScript 3,<br />Objective-C, and OpenSocial<br />http://www...
Yahoo! Social SDK – Features<br /><ul><li>Examples for OpenSocial, PHP, Python
Authenticating with OAuth
Fetching Profiles
Fetching and Inserting Updates
Fetching Connections
Executing YQL</li></li></ul><li>What is OpenSocial?<br /><ul><li>OpenSocial API
For developing applications on social networks</li></ul>Accessing social data (profiles, connections)<br />Fetching and in...
Collecting User Data With OpenSocial 0.8<br />/* OpenSocial PERSON data request */<br />var req = opensocial.newDataReques...
Collecting User Data With OpenSocial 0.8<br />/* response handler */<br />function response(data){<br />   var viewer = da...
PHP Example: OAuth Dance<br />$session = YahooSession::requireSession($key, $secret, $app_id)<br />$user = $session-&gt;ge...
PHP Example: Fetching Profile Data<br />$session = YahooSession::requireSession($key, $secret, $app_id)<br />$user = $sess...
Python Example: OAuth Dance<br />oauthapp = yahoo.application.OAuthApplication(key, secret, app_id, callback)<br /># fetch...
Python Example: Fetching Profile Data<br />oauthapp = yahoo.application.OAuthApplication(key, secret, app_id, callback)<br...
Yahoo! Updates<br />
Getting Updates With OpenSocial 0.8<br />var req = opensocial.newDataRequest();<br />var spec = new opensocial.IdSpec();<b...
Getting Updates With OpenSocial 0.8<br />function handleActivities(dataResponse) {<br />    var ownerActivities = dataResp...
PHP Example: Fetching Updates<br />$session = YahooSession::requireSession($key, $secret, $app_id)<br />$user = $session-&...
Python Example: Fetching Updates<br />oauthapp = yahoo.application.OAuthApplication(key, secret, app_id, callback)<br />up...
Inserting Updates with OpenSocial 0.8<br />var params = {}, activity;<br />params[opensocial.Activity.Field.TITLE] = title...
PHP Example: Inserting Updates<br />$session = YahooSession::requireSession($key, $secret, $app_id)<br />$user = $session-...
Python Example: Inserting Updates<br />oauthapp = yahoo.application.OAuthApplication(key, secret, app_id, callback)<br />u...
Fetching Connections With OpenSocial 0.8<br />/* get owner and owner friends */<br />var idspec = opensocial.newIdSpec({ &...
Fetching Connections With OpenSocial 0.8<br />/* connection response function */<br />function responseFriends(data){<br /...
PHP Example: Fetching Connections<br />$session = YahooSession::requireSession($key, $secret, $app_id)<br />$user = $sessi...
Python Example: Fetching Connections<br />oauthapp = yahoo.application.OAuthApplication(key, secret, app_id, callback)<br ...
The Yahoo! Query Language (YQL)<br />SELECT myColumn, myTitle <br />FROM myTable<br />WHERE col = &apos;value&apos; AND va...
Getting Social Data with YQL <br />select * from social.profile where guid=me<br />select * from social.connections where ...
Making AJAX Requests With OpenSocial 0.8<br />var params = {};<br />var url = &apos;http://developer.yahoo.com/yql/console...
Making AJAX Requests With OpenSocial 0.8<br />function callbackFunc(response){<br />    if (response.text){<br />        /...
PHP Example: Executing YQL<br />$application = new YahooApplication($key, $secret);<br />$results = $application-&gt;query...
Python Example: Executing YQL<br />oauthapp = yahoo.application.OAuthApplication(key, secret, app_id, callback)<br />resul...
Getting Started - Documentation<br />Y!OS Main Overview - http://developer.yahoo.com/yos<br />YAP Main Overview - http://d...
Yahoo! Social SDKs: Live Demo<br />Joyent Accelerator + PHP SDK<br /><ul><li>http://apps.yahoo.com/-ZVumNI5a</li></ul>Goog...
QUESTIONS?<br />EXAMPLES | TUTORIALS | CODE SAMPLES<br />developer.yahoo.com<br />
ENJOY THE REST OF<br />YAHOO! OPEN HACK DAY!<br />EXAMPLES | TUTORIALS | CODE SAMPLES<br />DEVELOPER.YAHOO.COM<br />
Open Hack NYC Yahoo Social SDKs
Open Hack NYC Yahoo Social SDKs
Upcoming SlideShare
Loading in...5
×

Open Hack NYC Yahoo Social SDKs

2,522

Published on

Open Hack NYC Yahoo Social SDKs

Published in: Technology
1 Comment
1 Like
Statistics
Notes
  • Download free full file version from this link without any survay lateste workink 100%
    http://gg.gg/9tv6eskzhim4q11
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
No Downloads
Views
Total Views
2,522
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
39
Comments
1
Likes
1
Embeds 0
No embeds

No notes for slide
  • OAuth is an open protocol, initiated by Blaine Cook and Chris Messina, to allow secure API authorization in a simple and standard method for desktop, mobile and web applications.For consumer developers, OAuth is a method to publish and interact with protected data. For service provider developers, OAuth gives users access to their data while protecting their account credentials. In other words, OAuth allows a user to grant access to their information on one site (the Service Provider), to another site (called Consumer), without sharing all of his or her identity.
  • Missed connections, this is how you find them.
  • Y!OS Main Overview - http://developer.yahoo.com/yosYAP Main Overview - http://developer.yahoo.com/yapYQL Docs - http://developer.yahoo.com/yqlYML Docs - http://developer.yahoo.com/yap/ymlYDN Forum - http://developer.yahoo.com/forumYAP Dashboard - http://developer.yahoo.com/dashboardYQL Console - http://developer.yahoo.com/yql/consoleApplication Gallery - http://apps.yahoo.com/myappsJSLint - http://www.jslint.comPHP SDK - http://developer.yahoo.com/social/sdk/AS3 SDK - http://developer.yahoo.com/flash/yos/Caja - http://code.google.com/p/google-caja/Caja Support - http://developer.yahoo.com/yap/guide/caja-support.html
  • Open Hack NYC Yahoo Social SDKs

    1. 1. Yahoo Social SDKs<br />Jon LeBlanc + Dustin Whittle<br />Yahoo! Developer Network<br />
    2. 2. EXAMPLES | TUTORIALS | CODE SAMPLES<br />developer.yahoo.com<br />
    3. 3.
    4. 4. Open applications are applications that run on the Yahoo! network: Yahoo! Homepage and My Yahoo!<br />OAuth applications are standalone applications the run off the Yahoo! network.<br />
    5. 5. SDK Prerequisites <br /><ul><li>ck = CONSUMER_KEY
    6. 6. cks = CONSUMER_SECRET
    7. 7. app = APPLICATION_ID
    8. 8. cb = CALLBACK_URL</li></li></ul><li>
    9. 9.
    10. 10.
    11. 11.
    12. 12.
    13. 13. SDK Code DiveWhat can you do?<br />11<br />
    14. 14. Yahoo! Social Apps – A good foundation<br />Scalable Hosting<br />Joyent – Free OpenSocial Accelerators<br />Google App Engine<br />Amazon EC2 + S3<br />Web App Framework<br />PHP (symfony)<br />Python (Django)<br />Ruby (Rails)<br />
    15. 15.
    16. 16. What SDK Languages Are Available?<br />PHP, Python, Java, ActionScript 3,<br />Objective-C, and OpenSocial<br />http://www.github.com/yahoo<br />
    17. 17. Yahoo! Social SDK – Features<br /><ul><li>Examples for OpenSocial, PHP, Python
    18. 18. Authenticating with OAuth
    19. 19. Fetching Profiles
    20. 20. Fetching and Inserting Updates
    21. 21. Fetching Connections
    22. 22. Executing YQL</li></li></ul><li>What is OpenSocial?<br /><ul><li>OpenSocial API
    23. 23. For developing applications on social networks</li></ul>Accessing social data (profiles, connections)<br />Fetching and inserting activities<br /><ul><li>Implemented by many containers</li></ul>Develop once, distribute broadly<br />
    24. 24.
    25. 25. Collecting User Data With OpenSocial 0.8<br />/* OpenSocial PERSON data request */<br />var req = opensocial.newDataRequest(); <br />var params = {};<br />params[opensocial.DataRequest.PeopleRequestFields.PROFILE_DETAILS] = [<br />opensocial.Person.Field.NAME,<br />opensocial.Person.Field.THUMBNAIL_URL<br />];<br />req.add(req.newFetchPersonRequest(&apos;VIEWER&apos;, params), &apos;viewer_profile&apos;);<br />req.send(response);<br />
    26. 26. Collecting User Data With OpenSocial 0.8<br />/* response handler */<br />function response(data){<br /> var viewer = data.get(&apos;viewer_profile&apos;).getData();<br /> var aboutme =<br /> viewer.getField(opensocial.Person.Field.NAME);<br />}<br />
    27. 27. PHP Example: OAuth Dance<br />$session = YahooSession::requireSession($key, $secret, $app_id)<br />$user = $session-&gt;getSessionedUser();<br />var_dump($user);<br />
    28. 28.
    29. 29.
    30. 30. PHP Example: Fetching Profile Data<br />$session = YahooSession::requireSession($key, $secret, $app_id)<br />$user = $session-&gt;getSessionedUser();<br />$profile = $user-&gt;getProfile();<br />var_dump($profile);<br />
    31. 31. Python Example: OAuth Dance<br />oauthapp = yahoo.application.OAuthApplication(key, secret, app_id, callback)<br /># fetch unauthorized request token<br />request_token = oauthapp.get_request_token(callback)<br /># authorize request token<br />authorization_url = oauthapp.get_authorization_url(request_token)<br /># refresh authorized request token with access token<br />access_token = oauthapp.get_access_token(request_token)<br />oauthapp.token = access_token<br />
    32. 32. Python Example: Fetching Profile Data<br />oauthapp = yahoo.application.OAuthApplication(key, secret, app_id, callback)<br />profile = oauthapp.getProfile()<br />print profile<br />
    33. 33. Yahoo! Updates<br />
    34. 34. Getting Updates With OpenSocial 0.8<br />var req = opensocial.newDataRequest();<br />var spec = new opensocial.IdSpec();<br />spec.setField(opensocial.IdSpec.Field.USER_ID, opensocial.IdSpec.PersonId.OWNER);<br />req.add(req.newFetchActivitiesRequest(spec), &apos;ownerActivities&apos;);<br />req.send(handleActivities);<br />
    35. 35. Getting Updates With OpenSocial 0.8<br />function handleActivities(dataResponse) {<br /> var ownerActivities = dataResponse.get(&apos;ownerActivities&apos;).getData();<br /> //parse owner activities<br />}<br />
    36. 36. PHP Example: Fetching Updates<br />$session = YahooSession::requireSession($key, $secret, $app_id)<br />$user = $session-&gt;getSessionedUser();<br />$updates = $user-&gt;getUpdates();<br />var_dump($updates);<br />
    37. 37. Python Example: Fetching Updates<br />oauthapp = yahoo.application.OAuthApplication(key, secret, app_id, callback)<br />updates = oauthapp.getUpdates() <br />print updates<br />
    38. 38. Inserting Updates with OpenSocial 0.8<br />var params = {}, activity;<br />params[opensocial.Activity.Field.TITLE] = title;<br />params[opensocial.Activity.Field.BODY] = body;<br />activity = opensocial.newActivity(params);<br />opensocial.requestCreateActivity(<br /> activity,<br /> opensocial.CreateActivityPriority.LOW,<br /> callback);<br />
    39. 39. PHP Example: Inserting Updates<br />$session = YahooSession::requireSession($key, $secret, $app_id)<br />$user = $session-&gt;getSessionedUser();<br />$update = $user-&gt;insertUpdate($suid, $title, $link, $description);<br />var_dump($update);<br />
    40. 40. Python Example: Inserting Updates<br />oauthapp = yahoo.application.OAuthApplication(key, secret, app_id, callback)<br />update = oauthapp.insertUpdate(title, description, link)<br />print update<br />
    41. 41. Fetching Connections With OpenSocial 0.8<br />/* get owner and owner friends */<br />var idspec = opensocial.newIdSpec({ &apos;userId&apos; : &apos;OWNER&apos;, &apos;groupId&apos; : &apos;FRIENDS&apos; });<br />var req = opensocial.newDataRequest();<br />req.add(req.newFetchPersonRequest(&apos;OWNER&apos;), &apos;get_owner&apos;);<br />req.add(req.newFetchPeopleRequest(idspec), &apos;get_friends&apos;);<br />req.send(responseFriends);<br />
    42. 42. Fetching Connections With OpenSocial 0.8<br />/* connection response function */<br />function responseFriends(data){<br /> var owner = data.get(&apos;get_owner&apos;).getData();<br /> var objFriends = data.get(&apos;get_friends&apos;).getData();<br /> var html = &apos;Friends of &apos; + <br />owner.getDisplayName() + &apos;&lt;br /&gt;&apos;;<br />objFriends.each(function(person) {<br /> html += person.getDisplayName() + &apos;&lt;br /&gt;&apos;;<br /> });     <br />}<br />
    43. 43. PHP Example: Fetching Connections<br />$session = YahooSession::requireSession($key, $secret, $app_id)<br />$user = $session-&gt;getSessionedUser();<br />$connections = $user-&gt;getConnections();<br />var_dump($connections);<br />
    44. 44. Python Example: Fetching Connections<br />oauthapp = yahoo.application.OAuthApplication(key, secret, app_id, callback)<br />connections = oauthapp.getConnections()<br />print connections<br />
    45. 45.
    46. 46.
    47. 47. The Yahoo! Query Language (YQL)<br />SELECT myColumn, myTitle <br />FROM myTable<br />WHERE col = &apos;value&apos; AND var = &apos;title‘<br />LIMIT 3 OFFSET 10 |<br />sort(field=&apos;myColumn&apos;) | reverse()<br />
    48. 48. Getting Social Data with YQL <br />select * from social.profile where guid=me<br />select * from social.connections where owner_guid=me<br />select message from social.profile.status where guid=me<br />select * from social.updates where guid=me<br />
    49. 49. Making AJAX Requests With OpenSocial 0.8<br />var params = {};<br />var url = &apos;http://developer.yahoo.com/yql/console/?q=select%20*%20from%20flickr.photos.search%20where%20text%3D%22Times%20Square%22&apos; <br />var callback = callbackFunc; <br />params[gadgets.io.RequestParameters.CONTENT_TYPE] = gadgets.io.ContentType.TEXT;<br />params[gadgets.io.RequestParameters.METHOD] = gadgets.io.MethodType.GET;<br />gadgets.io.makeRequest(url, callback, params);<br />
    50. 50. Making AJAX Requests With OpenSocial 0.8<br />function callbackFunc(response){<br /> if (response.text){<br /> //use response.txt<br /> }<br />}<br />
    51. 51. PHP Example: Executing YQL<br />$application = new YahooApplication($key, $secret);<br />$results = $application-&gt;query(‘select * from delicious.feeds.popular’);<br />var_dump($results);<br />
    52. 52. Python Example: Executing YQL<br />oauthapp = yahoo.application.OAuthApplication(key, secret, app_id, callback)<br />results = oauthapp.yql(&apos;select * from social.profile where guid=me&apos;)<br />print results<br />
    53. 53. Getting Started - Documentation<br />Y!OS Main Overview - http://developer.yahoo.com/yos<br />YAP Main Overview - http://developer.yahoo.com/yap<br />YQL Docs - http://developer.yahoo.com/yql<br />YML Docs - http://developer.yahoo.com/yap/yml<br />YDN Forum – http://developer.yahoo.com/forum<br />YAP Dashboard - http://developer.yahoo.com/dashboard<br />YQL Console - http://developer.yahoo.com/yql/console<br />Application Gallery - http://apps.yahoo.com/myapps<br />JSLint - http://www.jslint.com<br />Github SDKs – http://www.github.com/yahoo (yos-social-LANGUAGE)<br />PHP SDK - http://developer.yahoo.com/social/sdk/<br />AS3 SDK - http://developer.yahoo.com/flash/yos/<br />Caja - http://code.google.com/p/google-caja/<br />Caja Guide - http://developer.yahoo.com/yap/guide/caja-support.html<br />OpenSocial Spec - http://code.google.com/apis/opensocial<br />
    54. 54. Yahoo! Social SDKs: Live Demo<br />Joyent Accelerator + PHP SDK<br /><ul><li>http://apps.yahoo.com/-ZVumNI5a</li></ul>Google App Engine + Python SDK<br /><ul><li>http://yapdemo.appspot.com/</li></li></ul><li>
    55. 55.
    56. 56.
    57. 57. QUESTIONS?<br />EXAMPLES | TUTORIALS | CODE SAMPLES<br />developer.yahoo.com<br />
    58. 58. ENJOY THE REST OF<br />YAHOO! OPEN HACK DAY!<br />EXAMPLES | TUTORIALS | CODE SAMPLES<br />DEVELOPER.YAHOO.COM<br />
    1. A particular slide catching your eye?

      Clipping is a handy way to collect important slides you want to go back to later.

    ×