API Services

CCDB can be accessed through an Application programming interface (API), which allows easy data retrieval.
The API can be used either from a web browser or from an external program such as a Perl/Python/R script.
Data is accessible through the URL http://ccdb.tau.ac.il/services/ , followed by specific suffixes, as described below.

The URLs format is (case sensitive):
http://ccdb.tau.ac.il/services/<output type>/?<taxonomic rank>=<query>&format=<output format>
where variables in chevrons should be replaced by values according to user request, as follows:

<output type>
available values are: countsFull and countsPartial.
These allow retrieval of full or partial information for each row, respectively. Partial information includes full resolved name, gametophytic (n) and sporophytic (2n) counts.

<taxonomic rank>
available values are: species , genus , family , majorGroup
available delimiters for species : space and underscore (examples: Aloe_vera or Aloe vera)

value must be respective to the taxonomic rank chosen, the name of a genus, family, or majorGroup

<output format>
available values are: xml,json,csv

Example 1:
To retrieve full information of all counts in the genus Aloe in json format, access the URL:

Example 2:
To retrieve full information of all counts in the family Bryaceae in xml format, access the URL:

Example 3:
To retrieve partial information of all counts of Bryophytes in csv format:

Example 4:
To retrieve partial information of all counts of Aloe vera in xml format:

Accessing the API using an automatic script is done by retrieving the data from a URL, constructed according to the format described above.
For example, in Python 3, the following function may be used to retrieve full information for a given genus in JSON format:

import urllib.request

def retrieve_genus_counts(genus):
    response = urllib.request.urlopen('http://ccdb.tau.ac.il/services/countsFull/?genus=' + genus + '&format=json')
    return response.read()

And the equivalent subroutine in Perl 5 is:

use LWP::Simple;

sub retrieve_genus_counts{
    my $genus = $_[0];
    my $response = get("http://ccdb.tau.ac.il/services/countsFull/?genus=$genus&format=json");
    return $response;

R Package

An R package written by Matt Pennell which makes API calls from the CCDB named "Chromer" is currently available on CRAN and GitHub.
This package was developed as part of the rOpenSci project.