Skip to content
Sandor Weisz edited this page Jun 13, 2013 · 7 revisions
$ go run api/server.go

Then access the API:

$ curl "http://localhost:4000/wards/10/counts.json?service_code=4fd3b167e750846744000005"

You should see output like:

{
  "2013-06-06": 2,
  "2013-06-07": 4,
  "2013-06-09": 5,
  "2013-06-10": 6,
  "2013-06-12": 23
}

The service code parameter is any of the 14 service types we're tracking. You can access that list programmatically via the /services.json endpoint, or just consult this list:

       service_code       |          service_name          
--------------------------+--------------------------------
 4fd3b167e750846744000005 | Graffiti Removal
 4fd6e4ece750840569000019 | Restaurant Complaint
 4fd3b9bce750846c5300004a | Rodent Baiting / Rat Complaint
 4fd3bbf8e750846c53000069 | Tree Debris
 4ffa4c69601827691b000018 | Abandoned Vehicle
 4ffa9f2d6018277d400000c8 | Street Light 1 / Out
 4ffa971e6018277d4000000b | Pavement Cave-In Survey
 4ffa9cad6018277d4000007b | Alley Light Out
 4fd3bd72e750846c530000cd | Building Violation
 4ffa9db16018277d400000a2 | Traffic Signal Out
 4ffa995a6018277d4000003c | Street Cut Complaints
 4fd3b750e750846c5300001d | Sanitation Code Violation
 4fd3b656e750846c53000004 | Pothole in Street
 4fd3bd3de750846c530000b9 | Street Lights All / Out

You may need to do basic setup to get the API to run. Try running:

$ go get "github.com/bmizerany/pq"
$ go get "github.com/gorilla/mux"
Clone this wiki locally