Download presentation
Presentation is loading. Please wait.
Published byCornelius Booker Modified over 8 years ago
1
Lab #3: Programming Exercises for Social Web APIs By J. H. Wang Dec. 26, 2011
2
Outline Twitter/Plurk API Facebook API Other Social APIs
3
Twitter API To start programming with Twitter API – Document: https://dev.twitter.com/docs/ https://dev.twitter.com/docs/ – Using OAuth to gain authorized access – Start using the three APIs Rest API Search API Streaming API
4
OAuth (Open Authorization) An open standard for authorization – OAuth 1.0 (RFC 5849) – OAuth 2.0 (work in progress) Allowing users to hand out tokens instead of credentials (username, passwords) – Obtain access tokens to act on behalf of a user account 3-legged OAuth … Authorize all HTTP requests
5
Example POST /1/statuses/update.json?include_entities=true HTTP/1.1 Accept: */* Connection: close User-Agent: OAuth gem v0.4.4 Content-Type: application/x-www-form-urlencoded Content-Length: 76 Host: api.twitter.com status=Hello%20Ladies%20%2b%20Gentlemen%2c% 20a%20signed%20OAuth%20request%21
6
With OAuth 1.0a Authorization: OAuth oauth_consumer_key="xvz1evFS4wEEPTGEFPHBog", oauth_nonce="kYjzVBB8Y0ZFabxSWbWovY3uYSQ2pT gmZeNu2VS4cg", oauth_signature="tnnArxj06cWHq44gCs1OSKk%2FjL Y%3D", oauth_signature_method="HMAC-SHA1", oauth_timestamp="1318622958", oauth_token="370773112- GmHxMAgYyLbNEtIKZeRNFsMKPR9EyMZeS9weJAEb", oauth_version="1.0"
7
Twitter APIs Rest API – Providing twitter functions: read, write, read DM Search API – Real-time search index Streaming API – HTTP long poll connection
8
Rate Limits 350 OAuth calls /user /hour /IP Limits on the number of tweets / DMs Limits on the number of follows/unfollows per day
9
Plurk API 2.0 Document: http://www.plurk.com/APIhttp://www.plurk.com/API Sign un a plurk application – Not api_key needed Requests should be signed using OAuth 1.0a JSON encoded Plurk API libraries and OAuth libraries available
10
Facebook API Login facebook account, and set up new applications Authorization – OAuth Dialog recommended Social channels – Feed, requests,
11
Facebook Graph API Objects: – E.g.: https://graph.facebook.com/ or https://graph.facebook.com/<ID – Users, pages, events, groups, applications, status messages, photos, albums, videos, notes, … Relationships – E.g.: https://graph.facebook.com/ / https://graph.facebook.com/ /<CONNECTION_TYPE – Friends, news feed, likes, movies, music, books, notes, tags, groups, …
12
Searching – https://graph.facebook.com/search?q= &type= https://graph.facebook.com/search?q= &type=<ob j_type – obj_type: post, user, page, event, group, place, checkin Authorization – OAuth 2.0 Graph API Explorer https://developers.facebook.com/tools/explorer https://developers.facebook.com/tools/explorer
13
Facebook Social Plugins Buttons: like, send, subscribe, login Comments, activity feed, recommendations Registration, live stream, …
14
Other Social APIs Google+ API – GET https://www.googleapis.com/plus/v1/perople/ https://www.googleapis.com/plus/v1/perople/<u serId – key: API key – access_token: OAuth 2.0 token – JSON data format
15
Google Social Graph API – https://socialgraph.googleapis.com/ ? & & https://socialgraph.googleapis.com/ ?<p aram_1>& &<param_n – Methods lookup otherme testparse geturl
16
Thanks for Your Attention!
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.