rfishbase - database version toggling

rfishbase
r
Tags: #<Tag:0x00007f57f7add558> #<Tag:0x00007f57f7add418>

#1

We recently added support in the Fishbase API for database versions, see https://fishbaseapi.readme.io/docs/database-versions

(p.s. We also rolled out new Fishbase API docs https://fishbaseapi.readme.io/docs)

I just today added support to the R client for the API - rfishbase - on a branch https://github.com/ropensci/rfishbase/issues/134 Install like

devtools::install_github("ropensci/rfishbase@versions")

See new function versions() - and the parameter version in most of the exported functions.

versions function

Get the possible versions of the Fishbase database

versions()
#>   version   name date_released
#> 1      v1 201505    2015-05-20
#> 2      v2 201604    2016-04-28
#> 3      v3 201703    2017-03-31
#> 4      v4 201712    2017-12-13

specify a Fishbase database version

By default across the package we ask for data whatever the most recent version of the database is, in this case v4 (December 2017 [see versions() function for what different versions are]):

x <- ecology("Oreochromis niloticus", config = httr::verbose())
#> -> GET /ecology?SpecCode=2&limit=1 HTTP/2
#> -> Host: fishbase.ropensci.org
#> -> User-Agent: rfishbase/2.1.2.4 httr/1.3.1
#> -> Accept-Encoding: gzip, deflate
#> -> Accept: application/vnd.ropensci.v4+json __THIS HEADER SETS THE DATABASE VERSION__
#> -> 
#> <- <response headers removed for brevity>

You can ask for a specific version using the version parameter:

x <- ecology("Oreochromis niloticus", version = "v3", config = httr::verbose())
#> -> GET /ecology?SpecCode=2&limit=1 HTTP/2
#> -> Host: fishbase.ropensci.org
#> -> User-Agent: rfishbase/2.1.2.4 httr/1.3.1
#> -> Accept-Encoding: gzip, deflate
#> -> Accept: application/vnd.ropensci.v3+json __REQUEST VERSION 3__
#> -> 
#> <- <response headers removed for brevity>

Let us know what you think and if you find any problems.