Skip to content

REST API

eightysteele edited this page Mar 7, 2011 · 30 revisions

REST API

Cell lookup by value

Example request - "Get all bio1 variable cell values that are between 0 and 10"

GET api/cells/values?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

[
  {cell-key: "1-2-3", cell-value: "-50"},
  ...
]

Cell lookup by coordinates

Example - "Get the cell values for a list of variables that correspond to a list of coordinates or cell keys"

GET /api/cells/values?ll=1,2|7,3|...&v=bio1,bio2...

Parameter Description
ll A latitude/longitude pair separated by a comma (",") or list of pairs separated by a pipe ("|")
k Cell keys separated by a comma (",")
v Variable names separated by a comma (",")

Example JSON response

[
  {
    coordinate: "1,2", 
    cell-key: "1-2-3", 
    cell-values: 
      [
        {name: "bio1", value: "-50"},
        {name: "bio2", value: "-89"}
      ]
  },
  {
    coordinate: "7,3", 
    cell-key: "2-8-3", 
    cell-values: 
      [
        {name: "bio1", value: "-22"},
        {name: "bio2", value: "77"}
      ]
  }
]

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