Skip to content

REST API

eightysteele edited this page Mar 4, 2011 · 30 revisions

REST API

Cell lookup by value

Example request - "Get all bio1 variable cells with a value between 0 and 10"

GET api/cells?within=5&pivot=5&variable=bio1&limit=10&offset=0

Parameter Description
within Look for values within this range
pivot Look for values within range of this pivot value
variable The cell variable
limit The max number of cells to return (for paging)
offset The starting point offset of cells to return (for paging)

Example JSON response with 1 cell

[
  {variable: "bio1",
   value: "-50",
   cell: [
       {lat: -122.2887875, lng: 37.8603069},
       {lat: -122.2774275, lng: 37.8603069},
       {lat: -122.2729888, lng: 37.8686002},
       {lat: -122.2843488, lng: 37.8686002},
       {lat: -122.2887875, lng: 37.8603069}
   ]
  }
]

Cell lookup by single coordinate

Example - "Get the cell at latitude -122.2774275 and longitude 37.8603069"

GET /api/cells?ll=-122.2774275,37.8603069

Parameter Description
ll A latitude/longitude pair separated by a comma (",") or list of pairs separated by a pipe ("|")

Example JSON response with 1 cell

[
  {variable: "bio1",
   value: "-50",
   cell: [
       {lat: -122.2887875, lng: 37.8603069},
       {lat: -122.2774275, lng: 37.8603069},
       {lat: -122.2729888, lng: 37.8686002},
       {lat: -122.2843488, lng: 37.8686002},
       {lat: -122.2887875, lng: 37.8603069}
   ]
  }
]

Cell lookup by key

Example - "Lookup cell with key 1-2-3"

GET /api/cells/1-2-3

Example JSON response

[
  {variable: "bio1",
   value: "-50",
   cell: [
       {lat: -122.2887875, lng: 37.8603069},
       {lat: -122.2774275, lng: 37.8603069},
       {lat: -122.2729888, lng: 37.8686002},
       {lat: -122.2843488, lng: 37.8686002},
       {lat: -122.2887875, lng: 37.8603069}
   ]
  }
]

List all variables in JSON

GET /api/variables

List variable by name in JSON

GET /api/variables/bio1

Clone this wiki locally