Skip to content

How to retrieve data from detroit ledger

Benjamin Chodoroff edited this page Sep 8, 2013 · 1 revision

Detroit Ledger API

Using HTTP, anonymous users can retrieve most any data from Detroit Ledger. We're using the Drupal Services module. Here are some example queries.

While we're in development, the API base path is http://aug2013.dev.detroitledger.org/api/1.0/ - this will change someday!

Organizations

# top 5 organizations sorted by grants received
curl 'http://aug2013.dev.detroitledger.org/api/1.0/views/orgs.jsonp/?display_id=org_totals_services&sort_by=raw_sort_1&sort_order=DESC&limit=5'
# top 5 organizations sorted by grants funded
curl 'http://aug2013.dev.detroitledger.org/api/1.0/views/orgs.jsonp/?display_id=org_totals_services&sort_by=raw_sort&sort_order=DESC&limit=5'

Grants

# 10 grants (offset by 10 from starting record) received by organization ID 17476 (United Way for Southeastern Michigan), formatted as JSONP with callback "snarfler"
curl -g 'http://aug2013.dev.detroitledger.org/api/1.0/views/all_grants.jsonp/?display_id=grants_services&limit=10&offset=10&filters[recipient]=17476&callback=snarfler'
# up to 99999 grants funded by organization ID 17155 (DTE Energy Foundation)
curl -g 'http://aug2013.dev.detroitledger.org/api/1.0/views/all_grants.json/?display_id=grants_services&limit=99999&filters[funder]=17155'