Upgrade to Pro — share decks privately, control downloads, hide ads and more …

API-IN-A-BOX a containerized hypermedia approach to civic hacking by Shelby Switzer

API-IN-A-BOX a containerized hypermedia approach to civic hacking by Shelby Switzer

More Decks by API Strategy & Practice Conference

Other Decks in Technology

Transcript

  1. THE NEED: THE NEED: easy (and free) way to store

    and maintain data little or no changes to raw data has or can integrate with flexible, robust API does not need to be hosted simple setup locally or on any server
  2. { "business" : { "name" : "Hairy Convenience", "lat" :

    "33.760094", "lng" : "-84.386037", "bustype" : "convenience" } } document: mapping: { "business" : { "properties" : { "name" : { "type" : "string" }, "lat" : { "type" : "string" }, "lng" : { "type" : "string" }, "bustype" : { "type" : "string" }, "FILE_SOURCE": { "type": "string"}, } } }
  3. THE NEED: THE NEED: easy (and free) way to store

    and maintain data little or no changes to raw data has or can integrate with flexible, robust API does not need to be hosted simple setup locally or on any server
  4. { "collection" : "href" : "http://dockerip:4567/resources/", "items" : [ {

    "href" : "http://dockerip:4567/resources/8903493", "data" : [ {"name" : "name", "value" : "Bob's Convenience Store"}, {"name" : "lat", "value" : "33.760094"}, {"name" : "lng", "value" : "-84.386037"}, {"name" : "bustype", "value" : "convenience"}, {"name" : "FILE_SOURCE", "value" : "GA_EBT.csv"} ] } ], "queries" : [ {"rel":"search", "href":"http://dockerip:4567/resources/search", "prompt":"Search", "data" : [ {"name" : "name", "value" : ""}, {"name" : "lat", "value" : ""}, {"name" : "lng", "value" : ""}, {"name" : "bustype", "value" : ""}, {"name" : "FILE_SOURCE", "value": ""}, {"name" : "dedupe", "value" : ""} ] } ] } HYPERMEDIA: COLLECTION+JSON HYPERMEDIA: COLLECTION+JSON
  5. THE NEED: THE NEED: easy (and free) way to store

    and maintain data little or no changes to raw data has or can integrate with flexible, robust API does not need to be hosted simple setup locally or on any server
  6. api: build: ./api command: bash ./deploy/start.sh volumes: - api:/api ports:

    - "4567:4567" links: - elastic elastic: image: dockerfile/elasticsearch ports: - "9200:9200" - "9300:9300" volumes: - docker_volumes/elasticsearch_data:/usr/local/elasticsearch/data docker-compose.yml
  7. $ docker-compose up -e ORIGIN_REPO="switzersc/food-data" $ curl http://dockerip:4567/resources?dedupe=bustype 1. throw

    data into github repo 2. pull/build docker image 3. 4. API-IN-A-BOX API-IN-A-BOX
  8. THE NEED: THE NEED: easy (and free) to store and

    maintain data little or no changes to raw data has or can integrate with flexible, robust API does not need to be hosted simple setup locally or on any server