www.freshwaterecology.info
Freshwater Information Platform

FWE-API 2

General description

General description of the RESTful-API interface (FWE-API 2).

In this section, the following procedures are explained:

Get access

If you are interested in getting access to the freshwaterecology.info database via API, please follow the next two steps.

  • Registration: Before you can use the API, you need to register for freshwaterecology.info to get your personal login.  Registration
  • API-Key: To access the API interface, an API key is required. To get your API key, please send us an email with your registration data (registered name and email) at  registration@freshwaterecology.info.

NOTE: freshwaterecology.info is a joint effort of scientists for scientists and other interested individuals. The content of the database is meant to be freely available. It is therefore not permitted to integrate the API into commercial software, use the data provided by the API for commercial purposes or use it to build a similar website. Further, the data and the database have to be cited in any product that uses them.

FWE-API 2 - Documentation

FWE-API 2 with R

Making API requests in R

To create API requests in R, two libraries are required that provide the http and json functionality.
If the two libraries ("httr", "jsonlite") are not yet available in the R-Console or RStudio, they can be installed using install.package().

R-Console:


    >install.packages(c("httr", "jsonlite"))

GET /status

R-Console:


    >library(httr)
    >res = httr::GET("https://www.freshwaterecology.info/fweapi2/v1/status")
    >cat(content(res, 'text', encode = "UTF-8"))

POST /token

R-Console:


    >library(httr)
    >headers = c(
        'Content-Type' = 'application/json'
    )
    >body = '{
        "apikey": "your_apikey"
    }';
    >res = httr::POST("https://www.freshwaterecology.info/fweapi2/v1/status", body = body, add_headers(headers))
    >cat(content(res, 'text', encode = "UTF-8"))

GET /getecoparamlist

R-Console:


    >library(httr)
    >res = httr::GET("https://www.freshwaterecology.info/fweapi2/v1/getecoparamlist")
    >cat(content(res, 'text', encode = "UTF-8"))

POST /query

R-Console:


    >library(httr)
    >headers = c(
        'Authorization' = 'Bearer your_token',
        'Content-Type' = 'application/json'
    )
    >body = '{
        "organismgroup": "fi",
        "taxonname": "",
        "genus": "Salmo"
    }';
    >res = httr::POST("https://www.freshwaterecology.info/fweapi2/v1/query", body = body, add_headers(headers))
    >cat(content(res, 'text', encode = "UTF-8"))