Parts of the package nbaR
have been generated using
Swagger codegen.
Advantages of this processare:
Swagger is an API developer suite
to design, build, document, test, and standardize APIs and API workflows.
A central component of Swagger is to annotate the elements of an API, such as
data models and endpoints according to the
OpenAPI specification.
Code annotation is done in the code of the API itsself, see
here
for an example of an annotated resource class in the NBA.
Swagger parses the annotations and stores a meta-description of the entire API
into a single json
or yaml
file. The NBA is specified by the swagger file
reachable via this endpoint: http://api.biodiversitydata.nl/v2/reference-doc
We use this description, among others, to auto-generate endpoint documentation
for the NBA: http://docs.biodiversitydata.nl/endpoints-reference/
The Swagger codegen project allows for automatic generation of API client code using the swagger file containing the API specification, a codegen engine, and a number of template files. The below figure shows a schematic overview of the swagger codegen process:
R package file templates were taken from Swagger codegen and were adapted for this client. Files can be found here.
The Swagger codegen engine was modified to fit this client's needs. The code of the customised codegen engine can be found here.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.