taxize gained the new functions *ping()
(e.g., itis_ping()
) to allow you to ping each data provider that has a web API. That is, excluding those where we simply scrape data (e.g. IUCN), or download tabular data (The Plant List).
See the new functions:
col_ping()
itis_ping()
eol_ping()
ncbi_ping()
tropicos_ping()
nbn_ping()
gbif_ping()
ubio_ping()
bold_ping()
ipni_ping()
vascan_ping()
With these functions, by default we simply check if the HTTP status code is 200
(meaning, OK, it's up), return TRUE
if it is, and FALSE
if not. Instead you can match a certain HTTP status code (e.g, 400
), or match content. Matching content is a small API call, then we make sure the content returned is as expected, so if this test returns FALSE
, the service may be up, but the content returned is wrong (or has changed).
Install latest dev version of taxize
devtools::install_github("ropensci/taxize")
library("taxize")
Is a service up or not?
col_ping()
#> [1] TRUE
itis_ping()
#> [1] TRUE
eol_ping()
#> [1] TRUE
ncbi_ping()
#> [1] TRUE
tropicos_ping()
#> [1] TRUE
nbn_ping()
#> [1] TRUE
gbif_ping()
#> [1] TRUE
ubio_ping()
#> [1] TRUE
bold_ping()
#> [1] TRUE
ipni_ping()
#> [1] TRUE
vascan_ping()
#> [1] TRUE
Does the HTTP code returned match 200
? It should
nbn_ping(200)
#> [1] TRUE
It should not match 503, should return FALSE
nbn_ping(503)
#> [1] FALSE
We can ask if the output matches what's expected
nbn_ping("content")
#> [1] TRUE
vascan_ping("content")
#> [1] TRUE