Getting started
Introduction
This is the Trefle API documentation. The Trefle API aims to deliver all plants informations under an accessible interface.
All API access is over HTTPS, and accessed from https://trefle.io. All data is sent and received as JSON.
What You Need
In order to make queries, you'll need to create an account and get your personal access token first.
note
Your access token will allow you to makes queries on the Trefle API. Keep it private.
- Create an account on trefle.io
- Confirm your email address
- Login on your account
- Grab your Trefle access token
Make your first query
For the first examples, we will give you the choice between:
- Using your web browser, which is the simplest, but will be limited when we'll need to code a bit.
- Using your terminal, with
curl
- Using javascipt, with NodeJS and the
node-fetch
library (install it withyarn add node-fetch
).
We will first try to list all the plants.
- Browser
- CURL
- NodeJS
Open your browser and navigate to
It return a big JSON response like this:
Rate limiting
In order to allow all users to use the API in good conditions, a limit of 120 requests per minute is applied. If this limit is a limiting factor for your application (and you have valid reasons), feel free to contact us.
The Trefle structure
Before going further, we need to know a bit how data is organized in the trefle API.
The whole API structure is defined by the following classification:
For example, the balsam fir hierarchy is:
Plant and Species
For commodity reasons, we added a Plant
level between Genus and Species. A plant is the main species of a species, without all the forms, varieties, subspecies etc...
For each plant, we have one main species and several other "sub" species (which can be subspecies, varieties, hybrids, cultivars etc...).
For example, our balsam fir have:
- One species (which is our "plant"):
Abies balsamea
- One sub-species:
Abies balsamea ssp. lasiocarpa
- Two varieties:
Abies balsamea var. phanerolepis
andAbies balsamea var. balsamea