npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

iucn-red-list

v1.0.5

Published

SDK for IUCN Red List API

Downloads

12

Readme

IUCN Red List

IUCN Red List API wrapper for Node.js

Build Status

This project uses modern ES2016+ syntax, which means you can use promises (as shown in the documentation) or async/await.

Installation

npm install --save iucn-red-list

Usage

import {
  Country,
  GrowthForms,
  Habitat,
  Measure,
  Region,
  Species,
  Threat,
} from 'iucn-red-list';

Only import the modules you need. For example, if you only need the Country and Threat modules:

import {
  Country,
  Threat,
} from 'iucn-red-list';

To set your API Key, set the environment variable RED_LIST_TOKEN. Alternatively, you can set the configuration manually:

import { setRedListToken } from 'iucn-red-list';
setRedListToken('<your-token>')

Checking the Red List version

To check what version of the IUCN Red List is driving the API:

import { redListVersion } from 'iucn-red-list';
redListVersion().then(data => console.log(data));

Be sure to reference the Red List API docs

Country - Country information

Growth Forms - Plant growth form information

Habitat - Species habitat information

Measure - Species conservation measures information

Region - Region information

Species - Published species on the Red List

Threat - Species threat information

Retrieves a list of countries

Country
  .all()
  .then(data => console.log(data))
  .catch(err => console.log(err));

Retrieves a list of species by country

options (required) - [Object]
  • country (required) - [String] ISO-code of the country for which you want the list of species
Country
  .species({ country: 'AZ' })
  .then(data => console.log(data))
  .catch(err => console.log(err));

Retrieves a list of plant growth forms by species

options (required) - [Object]
  • name (required) - [String] Name of species. If name is not provided, id must be provided
  • id (required) - [String/Number] ID of species. If id is not provided, name must be provided. If both id and name are provided, id will take precedent and name will be ignored
  • region (optional) - [String] If provided, this option will return a regional assessment of the growth forms. Must be a valid region (see Region.all())
GrowthForms
  .fetch({ name: 'Quercus robur', region: 'europe' })
  .then(data => console.log(data))
  .catch(err => console.log(err));

Retrieves a list of habitats by species

options (required) - [Object]
  • name (required) - [String] Name of species. If name is not provided, id must be provided
  • id (required) - [String/Number] ID of species. If id is not provided, name must be provided. If both id and name are provided, id will take precedent and name will be ignored
  • region (optional) - [String] If provided, this option will return a regional assessment of the habitats. Must be a valid region (see Region.all())
Habitat
  .fetch({ name: 'Ursus maritimus', region: 'europe' })
  .then(data => console.log(data))
  .catch(err => console.log(err));

Retrieves a list of conservation measures by species

options (required) - [Object]
  • name (required) - [String] Name of species. If name is not provided, id must be provided
  • id (required) - [String/Number] ID of species. If id is not provided, name must be provided. If both id and name are provided, id will take precedent and name will be ignored
  • region (optional) - [String] If provided, this option will return a regional assessment of the measures. Must be a valid region (see Region.all())
Measure
  .fetch({ name: 'Ursus maritimus', region: 'europe' })
  .then(data => console.log(data))
  .catch(err => console.log(err));

Retrieves a list of regions

Region
  .all()
  .then(data => console.log(data))
  .catch(err => console.log(err));

Retrieves a list of species in a paginated list of 10,000 species per page.

options (required) - [Object]
  • page (required) - [Number] Page number to retrieve. First page is 0
  • region (optional) - [String] If provided, this option will return a regional assessment of the available species. Must be a valid region (see Region.all())
Species
  .fetch({ page: 2, region: 'europe' })
  .then(data => console.log(data))
  .catch(err => console.log(err));

Retrieves a count of species globally or by region.

options (required) - [Object]
  • region - [String] Region to filter species count by. Must be a valid region (see Region.all())
Species
  .count({ region: 'europe' })
  .then(data => console.log(data))
  .catch(err => console.log(err));

Retrieves a citation for a given species

options (required) - [Object]
  • name (required) - [String] Name of species. If name is not provided, id must be provided
  • id (required) - [String/Number] ID of species. If id is not provided, name must be provided. If both id and name are provided, id will take precedent and name will be ignored
  • region - [String] If provided, this option will return a regional assessment of the species. Must be a valid region (see Region.all())
Species
  .citation({ name: 'Loxodonta Africana' })
  .then(data => console.log(data))
  .catch(err => console.log(err));

Retrieves a list of species by category

options (required) - [Object]
  • category (required) - [String] Valid categories are DD, LC, NT, VU, EN, CR, EW, EX, LR/lc, LR/nt, LR/cd.
Species
  .category({ category: 'VU' })
  .then(data => console.log(data))
  .catch(err => console.log(err));

Retrieve information about a specific species

options (required) - [Object]
  • name (required) - [String] Name of species. If name is not provided, id must be provided
  • id (required) - [String/Number] ID of species. If id is not provided, name must be provided. If both id and name are provided, id will take precedent and name will be ignored
  • region - [String] If provided, this option will return a regional assessment of the species. Must be a valid region (see Region.all())
Species
  .find({ id: '22694927' })
  .then(data => console.log(data))
  .catch(err => console.log(err));

Retrieve narrative information about a specific species

options (required) - [Object]
  • name (required) - [String] Name of species. If name is not provided, id must be provided
  • id (required) - [String/Number] ID of species. If id is not provided, name must be provided. If both id and name are provided, id will take precedent and name will be ignored
  • region - [String] If provided, this option will return a regional assessment of the species. Must be a valid region (see Region.all())
Species
  .narrative({ name: 'Fratercula artica', region: 'europe' })
  .then(data => console.log(data))
  .catch(err => console.log(err));

Retrieve information about synonyms via an accepted species name, or vice versa i.e. this call tells you if there are synonyms for the species name, or whether it's a synonym of an accepted name

options (required) - [Object]
  • name (required) - [String] Name (or synonym) of species.
Species
  .synonym({ name: 'Loxodonta Africana' })
  .then(data => console.log(data))
  .catch(err => console.log(err));

Retrieve list of common names in various languages for a species

options (required) - [Object]
  • name (required) - [String] Name of species.
Species
  .commonNames({ name: 'Loxodonta Africana' })
  .then(data => console.log(data))
  .catch(err => console.log(err));

Retrieve a list of countries of occurrence by species name

options (required) - [Object]
  • name (required) - [String] Name of species. If name is not provided, id must be provided
  • id (required) - [String/Number] ID of species. If id is not provided, name must be provided. If both id and name are provided, id will take precedent and name will be ignored
  • region - [String] If provided, this option will return a regional assessment of the species. Must be a valid region (see Region.all())
Species
  .narrative({ name: 'Ursus maritimus', region: 'europe' })
  .then(data => console.log(data))
  .catch(err => console.log(err));

Retrieve a list of historical assessments by species name (including the current listing)

options (required) - [Object]
  • name (required) - [String] Name of species. If name is not provided, id must be provided
  • id (required) - [String/Number] ID of species. If id is not provided, name must be provided. If both id and name are provided, id will take precedent and name will be ignored
  • region - [String] If provided, this option will return a regional assessment of the species. Must be a valid region (see Region.all())
Species
  .narrative({ name: 'Ursus maritimus', region: 'europe' })
  .then(data => console.log(data))
  .catch(err => console.log(err));

Retrieve a direct link to the species page on the Red List website

options (required) - [Object]
  • name (required) - [String] Name (or synonym) of species.
Species
  .link({ name: 'Loxodonta Africana' })
  .then(data => console.log(data))
  .catch(err => console.log(err));

Retrieves a list of threats by species

options (required) - [Object]
  • name (required) - [String] Name of species. If name is not provided, id must be provided
  • id (required) - [String/Number] ID of species. If id is not provided, name must be provided. If both id and name are provided, id will take precedent and name will be ignored
  • region (optional) - [String] If provided, this option will return a regional assessment of the threats. Must be a valid region (see Region.all())
Threat
  .fetch({ name: 'Fratercula arctica', region: 'europe' })
  .then(data => console.log(data))
  .catch(err => console.log(err));