Apis 101


Published on

Slides explaining how to use Google Spreadsheets to access data from GSA's Social Media Registry API

1 Like
  • Be the first to comment

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide
  • 2. What is an API. Application Programming Interface. That's jargon. It means nothing. Greg Elin called it a remote control for software. That's one way of thinking about it.
  • If you have a smartphone, it has a list of contacts, for any other program to access your contacts, it has to use the contacts' API. The contacts' API is essentially the set of instructions that define what can be done with your contacts and how to do it. In recent years, we learned that the APIs that governed access to contacts on some phones were too generous, so the APIs to access the contacts were changed.
  • 4. So, I'm going to talk about GSA's Social Media Registry and its API. Particularly, I'm going to talk about the API-first approach that GSA took when building it. 5. The issue was this: we needed lists of what was official. People were getting spoofed. Agencies were afraid of being spoofed, or being unable to assert their authority. Previously, the .gov and .mil domains gave government their own *domain*, but as governments interact with citizens on .com domains – Twitter, Facebook, or Google+ – there's a need to know what's going on out there. Both by management within government, but by journalists and citizens.
  • 6. But! How to build it? The old USA.gov way wouldn't work. *Fedsourcing*.7. And how to present it? We didn't know. So we went API first. We build an API to put stuff into the registry and an API to get stuff out. It's all documented at registry.usa.gov.
  • Learning how to read URLs blew my mind.
  • Learning how to read URLs blew my mind.
  • Type this into any cell in a Google Spreadsheet
  • Type this into any cell in a Google Spreadsheet
  • Type this into any cell in a Google Spreadsheet
  • Type this into any cell in a Google Spreadsheet
  • Apis 101

    1. 1. APIs 101Jed Sundwall jed@measuredvoice.com @jedsundwall
    2. 2. Application Programming Interface
    3. 3. Has an API
    4. 4. USA.gov Social Media Registry
    5. 5. USA.gov Social Media Registry API + Fedsourcing
    6. 6. Let’s make some API calls!Step 1: Learn to read URLs
    7. 7. google.com/search?q=beyonce
    8. 8. google.com/search?q=beyonce
    9. 9. google.com/search?q=beyoncecommand delimiter parameter value
    10. 10. google.com/search?q=beyoncegoogle.com/search?q=beyonce&num=1 all delimiters after the first “?” are “&”s
    11. 11. google.com/search?q=beyoncegoogle.com/search?q=beyonce&num=1google.com/search?q=beyonce&num=5&hl=es
    12. 12. google.com/search?q=beyoncegoogle.com/search?q=beyonce&num=1google.com/search?q=beyonce&num=5&hl=estwitter.com/?lang=esyoutube.com/watch?v=iScNjy7U-Zo
    13. 13. Step 2: Write some URLs
    14. 14. USA.gov Social Media RegistryAgencies API + Services API + Accounts API
    15. 15. registry.usa.gov/agencies
    16. 16. registry.usa.gov/agenciesregistry.usa.gov/agencies.xml
    17. 17. registry.usa.gov/agenciesregistry.usa.gov/agencies.xmlregistry.usa.gov/agencies.json
    18. 18. registry.usa.gov/agenciesregistry.usa.gov/agencies.xmlregistry.usa.gov/agencies.json
    19. 19. registry.usa.gov/servicesregistry.usa.gov/services.xmlregistry.usa.gov/services.json
    20. 20. registry.usa.gov/accountsregistry.usa.gov/accounts.xmlregistry.usa.gov/accounts.json
    21. 21. registry.usa.gov/accounts?service_id=twitter&agency_id=nasa
    22. 22. registry.usa.gov/accounts?service_id=twitter&agency_id=nasaregistry.usa.gov/accounts.xml?service_id=twitter&agency_id=nasaregistry.usa.gov/accounts.json?service_id=twitter&agency_id=nasa
    23. 23. Step 3: Tell some machines to read our data
    24. 24. Google Spreadsheets + importXML()
    25. 25. =importXML( "http://registry.usa.gov/agencies.xml", "//agency_name”)
    26. 26. =importXML( "http://registry.usa.gov/agencies.xml", "//agency_name”) data source XPath
    27. 27. =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”)
    28. 28. =importXML("http://registry.usa.gov/accounts.xml?service_id=twitter&agency_id=nasa", "//service_url”)
    29. 29. So what?
    30. 30. Create more value than you capture. – @timoreilly
    31. 31. Don’t be afraid to ask for help.jed@measuredvoice.com@jedsundwall