Your SlideShare is downloading. ×
Jeff Siarto: Party Like It’s 1984, An introduction to social APIs
Jeff Siarto: Party Like It’s 1984, An introduction to social APIs
Jeff Siarto: Party Like It’s 1984, An introduction to social APIs
Jeff Siarto: Party Like It’s 1984, An introduction to social APIs
Jeff Siarto: Party Like It’s 1984, An introduction to social APIs
Jeff Siarto: Party Like It’s 1984, An introduction to social APIs
Jeff Siarto: Party Like It’s 1984, An introduction to social APIs
Jeff Siarto: Party Like It’s 1984, An introduction to social APIs
Jeff Siarto: Party Like It’s 1984, An introduction to social APIs
Jeff Siarto: Party Like It’s 1984, An introduction to social APIs
Jeff Siarto: Party Like It’s 1984, An introduction to social APIs
Jeff Siarto: Party Like It’s 1984, An introduction to social APIs
Jeff Siarto: Party Like It’s 1984, An introduction to social APIs
Jeff Siarto: Party Like It’s 1984, An introduction to social APIs
Jeff Siarto: Party Like It’s 1984, An introduction to social APIs
Jeff Siarto: Party Like It’s 1984, An introduction to social APIs
Jeff Siarto: Party Like It’s 1984, An introduction to social APIs
Jeff Siarto: Party Like It’s 1984, An introduction to social APIs
Jeff Siarto: Party Like It’s 1984, An introduction to social APIs
Jeff Siarto: Party Like It’s 1984, An introduction to social APIs
Jeff Siarto: Party Like It’s 1984, An introduction to social APIs
Jeff Siarto: Party Like It’s 1984, An introduction to social APIs
Jeff Siarto: Party Like It’s 1984, An introduction to social APIs
Jeff Siarto: Party Like It’s 1984, An introduction to social APIs
Jeff Siarto: Party Like It’s 1984, An introduction to social APIs
Jeff Siarto: Party Like It’s 1984, An introduction to social APIs
Jeff Siarto: Party Like It’s 1984, An introduction to social APIs
Jeff Siarto: Party Like It’s 1984, An introduction to social APIs
Jeff Siarto: Party Like It’s 1984, An introduction to social APIs
Jeff Siarto: Party Like It’s 1984, An introduction to social APIs
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Jeff Siarto: Party Like It’s 1984, An introduction to social APIs

513

Published on

Jeff Siarto, Co-founder Loudpixel: Party Like It’s 1984, An introduction to social APIs for SocialDevCamp 2010

Jeff Siarto, Co-founder Loudpixel: Party Like It’s 1984, An introduction to social APIs for SocialDevCamp 2010

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
513
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
3
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Party Like It’s 1984 An introduction to social APIs Jeff Siarto Co-founder, Loudpixel
  • 2. APIs are how machines read the web
  • 3. What are APIs? ★ “Application Programming Interface” ★ We’re talking about web APIs ★ Gives web apps an “interface” for interacting with other software ★ Typically returns data in structured formats like XML and JSON (Jason?)
  • 4. APIs are structured ★ Don’t confuse APIs with crawlers and robots (GoogleBot) ★ APIs deal with structured data (a user has an name, email and phone) ★ Data is available in a specified format and is usually documented
  • 5. JSON { "first_name": "Jeff", "last_name": "Siarto", "titles": [ "Partner", "Analyst", "Designer" ], "online": { "website": "http://siarto.com", "twitter": "@jsiarto", "github": "http://github.com/jsiarto" } }
  • 6. XML <?xml version="1.0" encoding="UTF-8"?> <first_name>Jeff</first_name> <last_name>Siarto</last_name> <titles> <title>Partner</title> <title>Analyst</title> <title>Designer</title> </titles> <online> <website>http://siarto.com</website> <twitter>@jsiarto</twitter> <github>http://github.com/jsiarto</github> </online>
  • 7. REST ★ Representational State Transfer ★ The web is built to utilize REST ★ Stateless ★ HTTP verbs: GET, POST, PUT, DELETE
  • 8. RESTful Web Services ★ Representational State Transfer ★ The web is built to utilize REST ★ Stateless ★ HTTP verbs: GET, POST, PUT, DELETE
  • 9. APIs make the social web work
  • 10. Telescreen
  • 11. Telescreen ★ Rails 2.3.8 ★ Basic mashup using RapLeaf, Twitter, Gravatar and Google Maps ★ Search proletarians (users) by email
  • 12. RapLeaf
  • 13. # environment.rb config.gem “rapleaf_api” # controller rapleaf = RapleafApi::Api.new(‘API_KEY’) # find a person @person = rapleaf.query(:type => :person, :opts => {:email => ‘steve@apple.com’}) # view @person.location # Chicago, Illinois, United States
  • 14. RapLeaf Data ★ Basics: name, age, gender, location, occupations, schools, earliest/latest activity, friend count ★ Site Memberships: bebo, facebook, flickr, friendster, hi5, linkedin, livejournal, multiply, myspace, myyearbook, plaxo, twitter
  • 15. Gravatar
  • 16. # top of controller require ‘md5’ # controller method # MD5 hash the user email address email_hash = MD5.new(params[:prole]) # build a gravatar URI @gravatar = "http://www.gravatar.com/avatar/# {email_hash}?s=150" # view image_tag @gravatar
  • 17. Google Maps
  • 18. # build a google maps URI image_tag("http://maps.google.com/maps/api/staticmap? center=#{url_for(@person.location)} &zoom=12&size=256x256&maptype=roadmap&sensor=false")
  • 19. # URI base http://maps.google.com/maps/api/ # map position and location staticmap?center=#{url_for(@person.location)} # zoom and size &zoom=12&size=256x256 # map type and sensor &maptype=roadmap&sensor=false
  • 20. Twitter
  • 21. # top of controller require 'net/http' require 'uri' # Parse Twitter username from RapLeaf twitter_handle = @person.memberships(:primary)[12] ["profile_url"].gsub("http://twitter.com/", "") unless twitter_handle.nil? # Construct URI uri = URI.parse("http://twitter.com/status/ user_timeline/#{twitter_handle}.json?count=3") # Get JSON @twitter = Net::HTTP.get_response(uri) # Make JSON a Ruby object @tweets = ActiveSupport::JSON.decode(@twitter.body)
  • 22. # view @tweets[0]['user']["description"] # loop through tweets with .each <% @tweets.each do |t| %> <li> <%= t['text'] %><br /><span class="status-url">< %= link_to(t['created_at'], "http://twitter.com/#{t ['user']['screen_name']}/status/#{t['id']}") %></a> </li> <% end %>
  • 23. http://twitter.com/status/user_timeline/jsiarto.json?count=3
  • 24. Thanks! Jeff Siarto (jsiarto) Co-founder, Loudpixel

×