Skip to content
Panayiotis edited this page Apr 22, 2016 · 7 revisions

# Get a list of species and ids

To get a list of the different species and their ids in the database you need to submit a GET request to backend/src/api/internal/list.php.

Request

GET backend/src/api/internal/list.php?item=species

Response

[
   {
      "id":"10",
      "name":"Badger"
   },
   {
      "id":"11",
      "name":"Blackbird"
   },
   {
      "id":"12",
      "name":"Domestic cat"
   }
]

# Get a list of sites and ids

To get a list of the different sites and their ids in the database you need to submit a GET request to backend/src/api/internal/list.php.

Request

GET backend/src/api/internal/list.php?item=sites

Response

[
   {
      "id":"1",
      "name":"[New site]"
   },
   {
      "id":"2",
      "name":"SBBS Little High Wood"
   },
   {
      "id":"3",
      "name":"my backyard"
   }
]

# Get a list of habitats and ids

To get a list of the different habitats and their ids in the database you need to submit a GET request to backend/src/api/internal/list.php.

Request

GET backend/src/api/internal/list.php?item=habitats

Response

[
   {
      "id":"103",
      "name":"forest - high density forest more than 60% canopy cover"
   },
   {
      "id":"104",
      "name":"woodland - low density forest less than 60% canopy cover"
   },
   {
      "id":"105",
      "name":"scrubland - dominated by shrubs, i.e. small to medium woody plants less than 8 m high"
   }
]

# Get a count of classifications per species

To get a count of classifications per species you need to submit a GET request to backend/src/api/internal/list.php.

Request

GET backend/src/api/internal/list.php?item=counts

Example

// insert full url
 $.get( "../backend/src/api/internal/list.php?item=counts", function( data ) {
  alert( "Data Loaded: " + data );
});

Response

[
   {
      "species":"20",
      "count":"15",
      "name":"Rabbit"
   },
   {
      "species":"22",
      "count":"281",
      "name":"Roe Deer"
   },
   {
      "species":"86",
      "count":"234",
      "name":"Nothing <span class='fa fa-ban'/>"
   },
   {
      "species":"87",
      "count":"7",
      "name":"Human <span class='fa fa-male'/>"
   }
]

Clone this wiki locally