api

Play around with the data.

We've collated data from several sources and munged it into a minimal JSON-based static database. The entirety of the site is powered by this single file and you're more than welcome to use it for your own purposes.

We also expose several other JSON files which can be used as lookup tables in combination with plants.json to help sort through the data.

Files & Models

  • plants.json

    Our primary database. This includes a breakdown of all currently-supported plants along with their common names, symptoms, images and affected animal types.

    This is an array of objects with the following structure:

    type Symptom struct {
    	// The human-readable name of the symptom
    	Name string `json:"name"`
    
    	// A machine-friendly version of the name
    	Slug string `json:"slug"`
    }
    
    type Common struct {
    	// The human-readable name of the common name
    	Name string `json:"name"`
    
    	// A machine-friendly version of the common name
    	Slug string `json:"slug"`
    }
    
    type Image struct {
    	// The original remote source of the image
    	SourceUrl string `json:"source_url"`
    
    	// The original author of the image
    	Attribution string `json:"attribution"`
    
    	// The associated CC license
    	License string `json:"license"`
    
    	// The path to the image hosted on this site
    	RelativePath string `json:"relative_path"`
    }
    
    type Plant struct {
    	// The unique identifier of the plant
    	Pid string `json:"pid"`
    
    	// The human-friendly name of the plant
    	Name string `json:"name"`
    
    	// A list of any animals affected by the plant
    	Animals []string `json:"animals"`
    
    	// A list of common names ( see above )
    	Common []Common `json:"common"`
    
    	// A list of symptoms ( see above )
    	Symptoms []Symptom `json:"symptoms"`
    
    	// A list of images ( see above )
    	Images []Image `json:"images"`
    
    	// The wikipedia entry associated with the plant
    	WikipediaUrl string `json:"wikipedia_url"`
    
    	// The family classification of the plant
    	Family string `json:"family"`
    }

    Download

    $ curl -sL plantsm.art/api/plants.json > plants.json
  • symptoms.json

    A distinct listing of all known symptoms with an associated listing of any related plant records.

    This is an array of objects with the following structure:

    type Symptom struct {
    	// The human-readable name of the symptom
    	Name string `json:"name"`
    
    	// A machine-friendly version of the name
    	Slug string `json:"slug"`
    
    	// The number of plants sharing this symptom
    	Count  int      `json:"count"`
    
    	// A list of ids for each associated plant
    	Plants []string `json:"plants"`
    }

    Download

    $ curl -sL plantsm.art/api/symptoms.json > symptoms.json
  • animals.json

    A distinct listing of all supported animal types with an associated listing of any related plant records.

    This is an array of objects with the following structure:

    type Animal struct {
    	// The name of the animal
    	Name string `json:"name"`
    
    	// The number of plants affecting this animal
    	Count  int      `json:"count"`
    
    	// A list of ids for each affecting plant
    	Plants []string `json:"plants"`
    }

    Download

    $ curl -sL plantsm.art/api/animals.json > animals.json

    Supplemental

    Use these files if you wish to have animal-specific listings.

  • taxa.json

    Structured facts for each plant, collected from Wikidata, GBIF and the USDA PLANTS database. The object maps each plant id to one record. Every field is optional.

    This is an object of pid keys with the following structure:

    type Taxon struct {
    	// The Wikidata item id
    	Wikidata string `json:"wikidata"`
    
    	// The GBIF taxon key
    	Gbif string `json:"gbif"`
    
    	// The iNaturalist taxon id
    	Inat string `json:"inat"`
    
    	// The USDA PLANTS symbol
    	Usda string `json:"usda"`
    
    	// Extra English vernacular names from GBIF
    	Vernacular []string `json:"vernacular"`
    
    	// The USDA duration, for example Perennial
    	Duration []string `json:"duration"`
    
    	// The USDA growth habit, for example Vine
    	GrowthHabit []string `json:"growth_habit"`
    
    	// Areas where GBIF marks the plant as native
    	NativeTo []string `json:"native_to"`
    
    	// Countries with the most wild observations on GBIF
    	ObservedIn []string `json:"observed_in"`
    
    	// The same countries as ISO 3166 alpha-2 codes
    	ObservedCodes []string `json:"observed_codes"`
    }

    Download

    $ curl -sL plantsm.art/api/taxa.json > taxa.json
  • toxicity.json

    The toxicity section of the Wikipedia article for each plant that has one. The object maps each plant id to one record. The text is CC BY-SA 4.0, so give attribution when you republish it.

    This is an object of pid keys with the following structure:

    type Toxicity struct {
    	// The heading of the source section
    	Heading string `json:"heading"`
    
    	// The section text, paragraphs split by blank lines
    	Text string `json:"text"`
    
    	// The source Wikipedia article
    	Url string `json:"url"`
    }

    Download

    $ curl -sL plantsm.art/api/toxicity.json > toxicity.json

Usage

These are known as "dumb" API endpoints. They are static flat files that are generated at "build time" before we deploy changes to production. They, like this site, live behind a CDN which is managed by Cloudflare. We do not impose rate-limits or any other restrictions with regards to access.

You may download these files locally without attribution and use them as you wish. The exception is toxicity.json: its text comes from Wikipedia under CC BY-SA 4.0, so keep the attribution when you republish it.

If you wish to use the associated images, be sure to abide by the associated Creative Commons license. You can find the specific license for each image using the .[].images[].license path in the plants.json dataset.