A clojure library for connecting to HTTP APIs that implement the Open311 GeoReport v2 specification.
Clojure
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
src/open311_clj
test/open311_clj
.gitignore
LICENSE
README.md
project.clj

README.md

open311-clj

A clojure library for connecting to HTTP APIs that implement the Open311 GeoReport v2 specification.

Usage

; http://wiki.open311.org/GeoReport_v2#GET_Service_List
(def random-service (rand-nth
  (open311-clj.core/services
    {:endpoint "http://test311api.cityofchicago.org/open311/v2"})))

; http://wiki.open311.org/GeoReport_v2#GET_Service_Definition
(open311-clj.core/service-definition (:service_code random-service)
  {:endpoint "http://test311api.cityofchicago.org/open311/v2"})

; http://wiki.open311.org/GeoReport_v2#GET_Service_Requests
(def random-request (rand-nth
  (open311-clj.core/requests
    {:endpoint "http://test311api.cityofchicago.org/open311/v2"})))

; http://wiki.open311.org/GeoReport_v2#GET_Service_Requests with params
; see specification for "Optional Arguments" that can be included
; e.g. "all open requests"
(def random-open-request (rand-nth
  (open311-clj.core/requests
    {:endpoint "http://test311api.cityofchicago.org/open311/v2"
     :params {:status "open"} })))

; http://wiki.open311.org/GeoReport_v2#GET_Service_Request
(open311-clj.core/request (:service_request_id random-request)
  {:endpoint "http://test311api.cityofchicago.org/open311/v2"})

TODO

  • functions for POSTing requests retrieving service_request_ids from tokens
  • TESTS!!! (My first clojure library, so have mercy)
  • docstrings
  • clojars (for ease of use)
  • (requests-lazy) - lazy sequence to "infinitely" iterate over requests pages

License

MIT License. See LICENSE