310 likes | 453 Vues
APIs 101 Class notes: http:// measuredvoice.com /apis-101/. Jed Sundwall jed@measuredvoice.com @jedsundwall. Application Programming Interface. Has an API. USA.gov Social Media Registry. USA.gov Social Media Registry API + Fedsourcing. Let’s make some API calls!
E N D
APIs 101 Class notes: http://measuredvoice.com/apis-101/ Jed Sundwall jed@measuredvoice.com @jedsundwall
USA.gov Social Media Registry API + Fedsourcing
Let’s make some API calls! Step 1: Learn to read URLs
google.com/search?q=beyonce command delimiter parameter value
google.com/search?q=beyonce google.com/search?q=beyonce&num=1 all delimiters after the first “?” are “&”s
google.com/search?q=beyonce google.com/search?q=beyonce&num=1 google.com/search?q=beyonce&num=5&hl=es
google.com/search?q=beyonce google.com/search?q=beyonce&num=1 google.com/search?q=beyonce&num=5&hl=es twitter.com/?lang=es youtube.com/watch?v=iScNjy7U-Zo
USA.gov Social Media Registry Agencies API + Services API + Accounts API
registry.usa.gov/agencies registry.usa.gov/agencies.xml
registry.usa.gov/agencies registry.usa.gov/agencies.xml registry.usa.gov/agencies.json
registry.usa.gov/services registry.usa.gov/services.xml registry.usa.gov/services.json
registry.usa.gov/accounts registry.usa.gov/accounts.xml registry.usa.gov/accounts.json
registry.usa.gov/accounts?service_id=twitter&agency_id=nasa registry.usa.gov/accounts.xml?service_id=twitter&agency_id=nasa registry.usa.gov/accounts.json?service_id=twitter&agency_id=nasa
=importXML( "http://registry.usa.gov/agencies.xml", "//agency_name" )
=importXML( "http://registry.usa.gov/agencies.xml", "//agency_name" ) data source XPath
=importXML( "http://registry.usa.gov/agencies.xml", "//agency_name" ) =importXML( "http://registry.usa.gov/agencies.xml", "//agency_id" ) =importXML( "http://registry.usa.gov/services.xml", "//service_id" )
=importXML( "http://registry.usa.gov/accounts.xml?service_id=twitter&agency_id=nasa", "//service_url" )
So what? http://ringdemos.measuredvoice.com/flickr/test Government Twitter autocomplete in Measured Voice
Create more value than you capture. – @timoreilly
Don’t be afraid to ask for help. jed@measuredvoice.com @jedsundwall