Y! Social APIs

Loading...

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

0 comments

Post a comment

    Post a comment
    Embed Video
    Edit your comment Cancel

    Favorites, Groups & Events

    Y! Social APIs - Presentation Transcript

    1. Yahoo! Social APIs zach graves zachg@yahoo-inc.com twitter: basictheory
    2. Yahoo! Profiles - http://profiles.yahoo.com me: http://profiles.yahoo.com/z.graves
    3. Simply put, Social Directory is the central location for Yahoo! user profile data, providing identity, relationships and content data from Yahoo profiles http://developer.yahoo.com/social
    4. What is a user? • A user is identified by a GUID. (no usernames are provided from Yahoo) • A GUID is a unique, permanent, alphanumeric identifier generated by Yahoo, and retrieved by your app. • Eg: ‘JTN7YJFGW3J4IF53MDOD5RF7YU’
    5. The API • RESTful API • Requires OAuth • Endpoint: http://social.yahooapis.com/v1/ • Resources for user profile, connections, updates and presence.
    6. International Support • The character encoding in the APIs is UTF-8 for both requests and responses. • All requests support a ‘region’ and ‘lang’ parameter. • The ‘lang’ param must conform to RFC 4646. (eg: ‘pt’) • The ‘region’ param must be an ISO 3166-1 alpha-2 country code. (eg: ‘br’) $args = array(“lang”=>”pt”, “region”=>“BR”);
    7. User Profiles • Contains various profile fields for full name, nickname, location, status, age, profile image and other meta data depending on the permissions given to the application. • Read-only access • 3 ‘views’ tinyusercard / usercard / extended profile (default) http://social.yahooapis.com/v1/user/{guid}/profile
    8. User Connections • A list of mutual friends a user has. • Read-only access • Represented by an array of GUIDs http://social.yahooapis.com/v1/user/{guid}/connections
    9. User Status • Provides information on the users status. • Read/Write Access • Contains start / end times, source, a unique ID and the message text. http://social.yahooapis.com/v1/user/{guid}/presence/presence
    10. User Updates • Contains a feed of shared activities and events throughout Yahoo and 3rd party applications. • Read-write access • “Enrique wrote a restaurant review of ‘Vinheria Percussi’ in Sao Paulo.” • Contains a title, link, date, description and unique update ID. http://social.yahooapis.com/v1/user/{guid}/updates
    11. Using with OAuth require(‘OAuth.php’); $guid = “JTN7YJFGW3J4IF53MDOD5RF7YU”; // defina a URL e os argumentos de formato, linguagem e regiao $url = “http://social.yahooapis.com/v1/user/$guid/profile”; $args = array(“format”=>“json”, “lang”=>”pt”, “region”=>“BR”); // Criar uma requisicao do nosso consumidor e token $request = OAuthRequest::from_consumer_and_token($this->consumer, $this->token, \"GET\", $url, $args); // Criar a chamada $request->sign_request($this->signatureMethod, $this->consumer, $this->token); // Obtenha os cabecalhos $headers = array($request->to_header()); $requestUrl = $url.http_build_query($args); // Fazer requisicao $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $requestUrl); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); curl_setopt($ch, CURLOPT_HEADER, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); return curl_exec($ch);
    12. Using with OAuth $guid = “JTN7YJFGW3J4IF53MDOD5RF7YU”; // defina a URL e os argumentos de formato, linguagem e regiao $url = “http://social.yahooapis.com/v1/user/$guid/profile”; $args = array(“format”=>“json”, “lang”=>”pt”, “region”=>“BR”); // Criar uma requisicao do nosso consumidor e token $request = OAuthRequest::from_consumer_and_token($this->consumer, $this->token, \"GET\", $url, $args); // Criar a chamada $request->sign_request($this->signatureMethod, $this->consumer, $this->token); // Obtenha os cabecalhos $headers = array($request->to_header()); $requestUrl = $url.http_build_query($args); // Fazer requisicao $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $requestUrl); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); curl_setopt($ch, CURLOPT_HEADER, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); return curl_exec($ch);
    13. Using with OAuth $guid = “JTN7YJFGW3J4IF53MDOD5RF7YU”; // defina a URL e os argumentos de formato, linguagem e regiao $url = “http://social.yahooapis.com/v1/user/$guid/profile”; $args = array(“format”=>“json”, “lang”=>”pt”, “region”=>“BR”); // Criar uma requisicao do nosso consumidor e token $request = OAuthRequest::from_consumer_and_token($this->consumer, $this->token, \"GET\", $url, $args); // Criar a chamada $request->sign_request($this->signatureMethod, $this->consumer, $this->token); // Obtenha os cabecalhos $headers = array($request->to_header()); $requestUrl = $url.http_build_query($args); // Fazer requisicao $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $requestUrl); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); curl_setopt($ch, CURLOPT_HEADER, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); return curl_exec($ch);
    14. Using with OAuth $guid = “JTN7YJFGW3J4IF53MDOD5RF7YU”; // defina a URL e os argumentos de formato, linguagem e regiao $url = “http://social.yahooapis.com/v1/user/$guid/profile”; $args = array(“format”=>“json”, “lang”=>”pt”, “region”=>“BR”); // Criar uma requisicao do nosso consumidor e token $request = OAuthRequest::from_consumer_and_token($this->consumer, $this->token, \"GET\", $url, $args); // Criar a chamada $request->sign_request($this->signatureMethod, $this->consumer, $this->token); // Obtenha os cabecalhos $headers = array($request->to_header()); $requestUrl = $url.http_build_query($args); // Fazer requisicao $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $requestUrl); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); curl_setopt($ch, CURLOPT_HEADER, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); return curl_exec($ch);
    15. Using with OAuth $guid = “JTN7YJFGW3J4IF53MDOD5RF7YU”; // defina a URL e os argumentos de formato, linguagem e regiao $url = “http://social.yahooapis.com/v1/user/$guid/profile”; $args = array(“format”=>“json”, “lang”=>”pt”, “region”=>“BR”); // Criar uma requisicao do nosso consumidor e token $request = OAuthRequest::from_consumer_and_token($this->consumer, $this->token, \"GET\", $url, $args); // Criar a chamada $request->sign_request($this->signatureMethod, $this->consumer, $this->token); // Obtenha os cabecalhos $headers = array($request->to_header()); $requestUrl = $url.http_build_query($args); // Fazer requisicao $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $requestUrl); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); curl_setopt($ch, CURLOPT_HEADER, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); return curl_exec($ch);
    16. Authorization: OAuth oauth_consumer_key=\"0685bd9184jfhq22...\", oauth_token=\"ad180jjd733klru7\", oauth_signature_method=\"HMAC-SHA1\", oauth_signature=\"wOJIO9A2W5mFwDgiDvZbTSMK%2FPY%3D\", oauth_timestamp=\"137131200\", oauth_nonce=\"4572616e48616d6d65724c61686176\", oauth_version=\"1.0\" Alternatively, the OAuth params can be passed as a query string with GET/POST along with your own parameters.
    17. REQUEST_URL + ?oauth_consumer_key=0685bd9184jfhq22... &oauth_token=ad180jjd733klru7 &oauth_signature_method=HMAC-SHA1 &oauth_signature=wOJIO9A2W5mFwDgiDvZbTSMK%2FPY%3D &oauth_timestamp=137131200 &oauth_nonce=4572616e48616d6d65724c61686176 &oauth_version=1.0
    18. Using the SDKs • We currently have two open SDKs for use with the Social Platform • PHP / ActionScript 3 • Currently working on code for other platforms... Java, Ruby... • Build your own if you need it. It is truly simple. http://developer.yahoo.com/flash/yos http://developer.yahoo.com/social/sdk
    19. Skip OAuth, just use the SDK require(‘lib/Yahoo.inc’); // Make sure you obtain application keys before continuing by visiting: // http://developer.yahoo.com/dashboard/ // Your consumer key goes here. $consumerKey = \"dj0yJmk9UFhBZHZxUm....\"; // Your consumer key secret goes here. $consumerKeySecret = \"7ce79407fa3a3...\"; // Your application ID goes here. $applicationId = \"BG4yma4c\"; // Get a session first. If the viewer isn't sessioned yet, this call // will redirect them to log in and authorize your application to $session = YahooSession::requireSession($consumerKey, $consumerKeySecret, $applicationId); // Get the currently sessioned user. That means the user who is // currently viewing this page. $user = $session->getSessionedUser(); // Load the profile for the current user. $profile = $user->loadProfile(); return $profile;
    20. Setting up an App • YDN Dashboard: http://developer.yahoo.com/dashboard/ • Create a new Open (YAP) or OAuth application • Set up your app environment. • Download and install PHP SDK.
    21. Questions?

    + basictheorybasictheory, 2 years ago

    custom

    898 views, 0 favs, 1 embeds more stats

    using the yahoo social apis + brief oauth

    More info about this presentation

    © All Rights Reserved

    • Total Views 898
      • 895 on SlideShare
      • 3 from embeds
    • Comments 0
    • Favorites 0
    • Downloads 7
    Most viewed embeds
    • 3 views on http://brhackday.pbwiki.com

    more

    All embeds
    • 3 views on http://brhackday.pbwiki.com

    less

    Flagged as inappropriate Flag as inappropriate
    Flag as inappropriate

    Select your reason for flagging this presentation as inappropriate. If needed, use the feedback form to let us know more details.

    Cancel
    File a copyright complaint
    Having problems? Go to our helpdesk?

    Categories