SlideShare une entreprise Scribd logo
1  sur  29
Party Like It’s 1984
An introduction to social APIs


Jeff Siarto
Co-founder, Loudpixel
APIs are how machines read the web
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?)
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
JSON
{
    "first_name": "Jeff",
    "last_name": "Siarto",
    "titles": [
        "Partner",
        "Analyst",
        "Designer"
    ],
    "online": {
        "website": "http://siarto.com",
        "twitter": "@jsiarto",
        "github": "http://github.com/jsiarto"
    }
}
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>
REST
★   Representational State Transfer
★   The web is built to utilize REST
★   Stateless
★   HTTP verbs: GET, POST, PUT, DELETE
APIs make the social web work
Telescreen
Telescreen
★   Rails 2.3.8
★   Basic mashup using RapLeaf, Twitter,
    Gravatar and Google Maps
★   Search proletarians (users) by email
RapLeaf
# 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
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
Gravatar
# 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
Google Maps
# 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")
# 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
Twitter
# 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)
# 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 %>
http://twitter.com/status/user_timeline/jsiarto.json?count=3
Thanks!
Jeff Siarto (jsiarto)
Co-founder, Loudpixel

Contenu connexe

Similaire à Introduction to Social APIs

Motion Django Meetup
Motion Django MeetupMotion Django Meetup
Motion Django MeetupMike Malone
 
Tools, Frameworks, & Swift for iOS
Tools, Frameworks, & Swift for iOSTools, Frameworks, & Swift for iOS
Tools, Frameworks, & Swift for iOSTeri Grossheim
 
Apache Sling as an OSGi-powered REST middleware
Apache Sling as an OSGi-powered REST middlewareApache Sling as an OSGi-powered REST middleware
Apache Sling as an OSGi-powered REST middlewareRobert Munteanu
 
Building Apis in Scala with Playframework2
Building Apis in Scala with Playframework2Building Apis in Scala with Playframework2
Building Apis in Scala with Playframework2Manish Pandit
 
Buildingplatforms
BuildingplatformsBuildingplatforms
Buildingplatformscodebits
 
Mashup University 4: Intro To Mashups
Mashup University 4: Intro To MashupsMashup University 4: Intro To Mashups
Mashup University 4: Intro To MashupsJohn Herren
 
Build APIs With Kapow Mashup Server
Build APIs With Kapow Mashup ServerBuild APIs With Kapow Mashup Server
Build APIs With Kapow Mashup ServerAndreas Krohn
 
Goodle Developer Days Munich 2008 - Open Social Update
Goodle Developer Days Munich 2008 - Open Social UpdateGoodle Developer Days Munich 2008 - Open Social Update
Goodle Developer Days Munich 2008 - Open Social UpdatePatrick Chanezon
 
Yahoo! BOSS in Bucharest
Yahoo! BOSS in BucharestYahoo! BOSS in Bucharest
Yahoo! BOSS in BucharestTed Drake
 
創作 MusicKit 告白情歌
創作 MusicKit 告白情歌創作 MusicKit 告白情歌
創作 MusicKit 告白情歌彼得潘 Pan
 
Creating an API with Expressive
Creating an API with ExpressiveCreating an API with Expressive
Creating an API with ExpressiveElton Minetto
 
Finding things on the web with BOSS
Finding things on the web with BOSSFinding things on the web with BOSS
Finding things on the web with BOSSChristian Heilmann
 
Designing a beautiful REST json api
Designing a beautiful REST json apiDesigning a beautiful REST json api
Designing a beautiful REST json api0x07de
 
The liferay case: lessons learned evolving from RPC to Hypermedia REST APIs
The liferay case: lessons learned evolving from RPC to Hypermedia REST APIsThe liferay case: lessons learned evolving from RPC to Hypermedia REST APIs
The liferay case: lessons learned evolving from RPC to Hypermedia REST APIsJorge Ferrer
 
Developing on the aloashbei platform
Developing on the aloashbei platformDeveloping on the aloashbei platform
Developing on the aloashbei platformpycharmer
 
A high profile project with Symfony and API Platform: beIN SPORTS
A high profile project with Symfony and API Platform: beIN SPORTSA high profile project with Symfony and API Platform: beIN SPORTS
A high profile project with Symfony and API Platform: beIN SPORTSSmile I.T is open
 
Graph Analysis over JSON, Larus
Graph Analysis over JSON, LarusGraph Analysis over JSON, Larus
Graph Analysis over JSON, LarusNeo4j
 

Similaire à Introduction to Social APIs (20)

Hi5 Open Social
Hi5   Open SocialHi5   Open Social
Hi5 Open Social
 
Motion Django Meetup
Motion Django MeetupMotion Django Meetup
Motion Django Meetup
 
Tools, Frameworks, & Swift for iOS
Tools, Frameworks, & Swift for iOSTools, Frameworks, & Swift for iOS
Tools, Frameworks, & Swift for iOS
 
Apache Sling as an OSGi-powered REST middleware
Apache Sling as an OSGi-powered REST middlewareApache Sling as an OSGi-powered REST middleware
Apache Sling as an OSGi-powered REST middleware
 
Building Apis in Scala with Playframework2
Building Apis in Scala with Playframework2Building Apis in Scala with Playframework2
Building Apis in Scala with Playframework2
 
Buildingplatforms
BuildingplatformsBuildingplatforms
Buildingplatforms
 
Mashup University 4: Intro To Mashups
Mashup University 4: Intro To MashupsMashup University 4: Intro To Mashups
Mashup University 4: Intro To Mashups
 
Build APIs With Kapow Mashup Server
Build APIs With Kapow Mashup ServerBuild APIs With Kapow Mashup Server
Build APIs With Kapow Mashup Server
 
Goodle Developer Days Munich 2008 - Open Social Update
Goodle Developer Days Munich 2008 - Open Social UpdateGoodle Developer Days Munich 2008 - Open Social Update
Goodle Developer Days Munich 2008 - Open Social Update
 
Yahoo! BOSS in Bucharest
Yahoo! BOSS in BucharestYahoo! BOSS in Bucharest
Yahoo! BOSS in Bucharest
 
創作 MusicKit 告白情歌
創作 MusicKit 告白情歌創作 MusicKit 告白情歌
創作 MusicKit 告白情歌
 
Creating an API with Expressive
Creating an API with ExpressiveCreating an API with Expressive
Creating an API with Expressive
 
Finding things on the web with BOSS
Finding things on the web with BOSSFinding things on the web with BOSS
Finding things on the web with BOSS
 
Designing a beautiful REST json api
Designing a beautiful REST json apiDesigning a beautiful REST json api
Designing a beautiful REST json api
 
The liferay case: lessons learned evolving from RPC to Hypermedia REST APIs
The liferay case: lessons learned evolving from RPC to Hypermedia REST APIsThe liferay case: lessons learned evolving from RPC to Hypermedia REST APIs
The liferay case: lessons learned evolving from RPC to Hypermedia REST APIs
 
Developing on the aloashbei platform
Developing on the aloashbei platformDeveloping on the aloashbei platform
Developing on the aloashbei platform
 
xAPI Vocabulary - Improving Semantic Interoperability of Controlled Vocabularies
xAPI Vocabulary - Improving Semantic Interoperability of Controlled VocabulariesxAPI Vocabulary - Improving Semantic Interoperability of Controlled Vocabularies
xAPI Vocabulary - Improving Semantic Interoperability of Controlled Vocabularies
 
Yahoo is open to developers
Yahoo is open to developersYahoo is open to developers
Yahoo is open to developers
 
A high profile project with Symfony and API Platform: beIN SPORTS
A high profile project with Symfony and API Platform: beIN SPORTSA high profile project with Symfony and API Platform: beIN SPORTS
A high profile project with Symfony and API Platform: beIN SPORTS
 
Graph Analysis over JSON, Larus
Graph Analysis over JSON, LarusGraph Analysis over JSON, Larus
Graph Analysis over JSON, Larus
 

Dernier

EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 

Dernier (20)

EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 

Introduction to Social APIs

  • 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. APIs make the social web work
  • 10. Telescreen ★ Rails 2.3.8 ★ Basic mashup using RapLeaf, Twitter, Gravatar and Google Maps ★ Search proletarians (users) by email
  • 11.
  • 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.
  • 17. # 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
  • 18.
  • 20. # 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")
  • 21. # 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
  • 22.
  • 24. # 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)
  • 25. # 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 %>
  • 27.
  • 28.