The polytraits database can be accessed through a REST API. The format of the API is as follows:

http://polytraits.lifewatchgreece.eu/{method}/{query}/{format}/?{other parameter key value pairs}

Two methods are currently available:

  1. taxon: searches for a taxon name and returns taxon identifier(s)
  2. traits: retrieves traits information for one or more taxon identifiers
The methods are described below. An exemplary client implementing the two methods is provided both as a PHP and a perl script.


taxon

A method to search for taxa in the Polytraits database. Returns matching taxon identifiers.

URL: http://polytraits.lifewatchgreece.eu/taxon/{query}/{format}/?{other parameter key value pairs}

Example: Retrieve all taxon information about taxa starting with "Syllis" and return them as a numeric array:
http://polytraits.lifewatchgreece.eu/taxon/Syllis/json/?exact=0&verbose=1&assoc=0

Parameter name Data type Allowed values Default value Parameter note Output
query string any taxon name spaces have to be url-encoded, case-insensitive
format string json|xml json Optional.Currently only json is implemented
exact boolean 1|0 1 optional When true, returns only the exact match for the query string. When false, returns all matches beginning with the query string
verbose boolean 1|0 0 optional When true, returns per taxon: array (taxon ID, taxon name, authority, valid taxon ID, valid taxon name, valid authority, taxonomic status, source of synonymy, rank). When false, returns per taxon: array (taxon ID, taxon name).
assoc boolean 1|0 0 optional When true, an associative array is returned with the taxon ID as keys. When false, a numeric array is returned.

traits

A method to retrieve trait information for one or more taxon identifiers. Returns all trait information for the given IDs

URL: http://polytraits.lifewatchgreece.eu/traits/{query}/{format}/?{other parameter key value pairs}

Example: Retrieve all trait information about the taxa with ID 1 and 2 and return them as an associative array with the taxon IDs as keys
http://polytraits.lifewatchgreece.eu/traits/1,2/json/?verbose=1&assoc=1

A description of the returned fields can be viewed at: Return fields

Parameter name Data type Allowed values Default value Parameter note Output
query integer or string one or more taxon identifiers, comma-separated Use “taxon” method to retrieve a list of IDs. Up to 10 Ids are allowed.
format string json|xml json Optional. Currently only json is implemented
verbose boolean 1|0 1 Optional When true, returns per taxon the fields documented here. When false, returns per taxon: array(trait, modality, traitvalue)
assoc boolean 1|0 1 optional When true, an associative array is returned with the taxon ID as keys. When false, a numeric array is returned.