ropensci / rredlist

IUCN Red List API Client
https://docs.ropensci.org/rredlist
Other
50 stars 15 forks source link

$result is list() and NULL #27

Closed git-og closed 6 years ago

git-og commented 6 years ago
Session Info ```r > sessionInfo() R version 3.4.3 (2017-11-30) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 7 x64 (build 7601) Service Pack 1 Matrix products: default locale: [1] LC_COLLATE=English_United Kingdom.1252 LC_CTYPE=English_United Kingdom.1252 [3] LC_MONETARY=English_United Kingdom.1252 LC_NUMERIC=C [5] LC_TIME=English_United Kingdom.1252 attached base packages: [1] stats graphics grDevices utils datasets methods base other attached packages: [1] rredlist_0.4.0 taxize_0.9.2 xlsx_0.5.7 xlsxjars_0.6.1 rJava_0.9-9 loaded via a namespace (and not attached): [1] Rcpp_0.12.15 xml2_1.1.1 magrittr_1.5 ape_5.0 lattice_0.20-35 [6] R6_2.2.2 rlang_0.2.0 foreach_1.4.3 stringr_1.2.0 httr_1.3.1 [11] plyr_1.8.4 tools_3.4.3 parallel_3.4.3 bold_0.5.0 grid_3.4.3 [16] data.table_1.10.4 nlme_3.1-131 iterators_1.0.8 yaml_2.1.14 httpcode_0.2.0 [21] tibble_1.4.2 reshape2_1.4.2 codetools_0.2-15 triebeard_0.3.0 curl_2.8.1 [26] crul_0.4.0 mime_0.5 stringi_1.1.5 pillar_1.2.1 compiler_3.4.3 [31] urltools_1.6.0 jsonlite_1.5 reshape_0.8.7 zoo_1.8-0 ```

EDIT: Whoops, my fault - the test species I used happened to be synonyms that didn't return results from IUCN! Ignore the below!

Thanks for a great tool. Since I last used the package, something seems to have changed, as the $result element now returns NULL. See below.

> results<-rl_search(name = "Artocarpus rigidus", key = key, verbose = TRUE)
* Found bundle for host apiv3.iucnredlist.org: 0x46d9a620 [can pipeline]
* Re-using existing connection! (#17) with host apiv3.iucnredlist.org
* Connected to apiv3.iucnredlist.org (176.58.126.20) port 80 (#17)
> GET /api/v3/species/Artocarpus%20rigidus?token=HIDDEN HTTP/1.1
Host: apiv3.iucnredlist.org
User-Agent: libcurl/7.54.1 r-curl/2.8.1 crul/0.4.0
Accept-Encoding: gzip, deflate
Accept: application/json, text/xml, application/xml, */*

< HTTP/1.1 200 OK
< Server: nginx/1.1.19
< Date: Sun, 11 Mar 2018 08:32:26 GMT
< Content-Type: application/json; charset=utf-8
< Content-Length: 41
< Connection: keep-alive
< X-Powered-By: Sails <sailsjs.org>
* Added cookie sails.sid="s%3AHglE_b-TyiEDpz-H7hPxz_Xq.Ko3gdIu10LW2aI%2BOYLa1Tfa9ususo7d5WWDwOqGchw8" for domain apiv3.iucnredlist.org, path /, expire 0
< Set-Cookie: sails.sid=s%3AHglE_b-TyiEDpz-H7hPxz_Xq.Ko3gdIu10LW2aI%2BOYLa1Tfa9ususo7d5WWDwOqGchw8; Path=/; HttpOnly
< Vary: Accept-Encoding
< 
* Connection #17 to host apiv3.iucnredlist.org left intact
> results
$name
[1] "Artocarpus rigidus"

$result
list()

I have used two different API keys, one I know was working previously, and a new one (that has been idle for a few months). I did iterate through several hundred species on the first run (with an error in the code meaning I can see if the first few worked), but even several minutes to half an hour later I get the same result.

git-og commented 6 years ago

Issue resolved, my test species were synonyms and weren't resolved by IUCN.

sckott commented 6 years ago

@git-og nice job figuring it out