Skip to content

Aggregate API

eightysteele edited this page Jan 16, 2012 · 8 revisions

Aggregate API

The aggregate API returns data on forest clearing activity detected by FORMA, aggregated to countries, provinces, and sub-provinces.

Parameter Description Example
admin_level The administrative unit (0=country, 1=province, 2=sub-province) 0
name That name of the administrative unit. Indonesia
start Starting point of the timeseries. 2-2008
stop Stopping point of the timeseries. 2-2009
iso he 3-digit ISO code for a country. IDN

Examples

Here are some example API requests and responses.

Get clearing data for the most recent time period for all countries

GET /api/aggregate/countries

{
  "start":{
    "month":12,
    "year":2011
  },
  "end":{
    "month":12,
    "year":2011
  },
  "countries":{
    "bra":{
      "index":5,
      "iso":"bra",
      "name":"Brazil"
    },
    "idn":{
      "index":9,
      "iso":"idn",
      "name":"Indonesia"
    },
    "mys":{
      "index":15,
      "iso":"mys",
      "name":"Malaysia"
    }
  }
}

Get data for all periods for Indonesia

GET /aggregate/idn

{
  "admin_level":0,
  "end":{
    "month":12,
    "year":2011
  },
  "name":"Indonesia",
  "index":[38, 32, 26, 70, 26, 71, 7, 68, 59, 88, 90, 75, 73, 73, 87, 74, 87, 78, 47, 35, 8, 12, 14, 61, 57, 27, 97, 29, 38, 70, 10, 40, 57, 96, 20, 30, 63, 28, 84, 54, 90, 47, 78, 9, 72, 63, 87, 95, 39, 91, 93, 35, 33, 20, 80, 98, 61, 13, 72, 74, 36, 99, 58, 52, 79, 93, 57, 45, 43, 37, 64, 68],
  "start":{
    "month":1,
    "year":2006
  },
  "iso":"idn"
}

Get most recent data for all provinces in Indonesia

GET /aggregate/idn/provinces

{
  "provinces":{
    "1254":{
      "id1":1254,
      "name":"Aceh",
      "index":12
    },
    "1256":{
      "id1":1256,
      "name":"Bangka-Belitung",
      "index":2
    },
    "1257":{
      "id1":1257,
      "name":"Banten",
      "index":0
    },
    "1258":{
      "id1":1258,
      "name":"Bengkulu",
      "index":9
    },
    "1259":{
      "id1":1259,
      "name":"Gorontalo",
      "index":0
    }
  },
  "iso":"idn",
  "admin_level":1,
  "start":{
    "month":12,
    "year":2011
  },
  "end":{
    "month":12,
    "year":2011
  }
}

Get full timeseries for a province of Indonesia

GET /aggregate/idn/123

{
  "admin_level":1,
  "end":{
    "month":12,
    "year":2011
  },
  "name":"Aceh",
  "index":[38, 32, 26, 70, 26, 71, 7, 68, 59, 88, 90, 75, 73, 73, 87, 74, 87, 78, 47, 35, 8, 12, 14, 61, 57, 27, 97, 29, 38, 70, 10, 40, 57, 96, 20, 30, 63, 28, 84, 54, 90, 47, 78, 9, 72, 63, 87, 95, 39, 91, 93, 35, 33, 20, 80, 98, 61, 13, 72, 74, 36, 99, 58, 52, 79, 93, 57, 45, 43, 37, 64, 68],
  "start":{
    "month":1,
    "year":2006
  },
  "iso":"idn"
}
Clone this wiki locally