Main data types and classes
The data served by the NBA consists of four main data types:
Additionally, the data type Metadata stores miscellaneous information about NBA settings. Each of the data types is modelled as an
R6 class and therefore has its own members such as fields and methods. Documentation about a specific class can be retrieved in the standard manner, e.g.
?Specimen Each class of the data model can be instantiated and has a
toList method returning the object’s JSON representation and the object’s data as a list datatype, respectively.
API Client classes
The interaction with the API is accomplished by the API client classes:
The client class is by default initialized to connect to the base URL http://api.biodiversitydata.nl/v2. For testing purposes, this can be set to a different URL, see
?SpecimenClient for details.
With the SpecimentClient created above, the
query endpoint for specimens can now be reached via the
query function then returns an object of class
Response, which, in turn, has a field
content of class
QueryResult. From the
QueryResult, the single result items can be accessed as follows:
##  "Specimen" "R6"
Passing query parameters as list
Query parameters can be specified as a list with named parameters. To query for instance for specimen records that have the type status holotype and a female sex, one can pass a named list as the
queryParams parameter to the
Note that by default, both conditions are connected by a logical
queryParams passed as a list thus correspond to basic human readable queries. For more advanced queries, containing different logical operators or nested sub-queries, the user can specify the query in a