Skip to content

ebird_GET() : Unknown species: Genus%20species = double url encoding ? #62

@Alanamosse

Description

@Alanamosse

I couldn't use ebird_GET() without a warning like :
In ebird_GET(url, args, ...) : Unknown species: Anas%20platyrhynchos

It seems that the space charater ' ' is encoded two times : ' ' ->'%20' ->'%2520'

GET function use an url with 'Anas%2520platyrhynchos' instead of 'Anas%20platyrhynchos'.
See the following example with the verbose enabled :
``

ebirdgeo('Anas platyrhynchos', 39, -121, max=5, config=verbose())
-> GET /ws1.1/data/obs/geo_spp/recent?fmt=json&sci=Anas%20platyrhynchos&lat=39&lng=-121&maxResults=5 HTTP/1.1
-> Host: ebird.org
-> User-Agent: libcurl/7.59.0 r-curl/3.2 httr/1.3.1
-> Accept-Encoding: gzip, deflate
-> Accept: application/json, text/xml, application/xml, /
->
<- HTTP/1.1 302 Found
<- Date: Tue, 05 Jun 2018 13:39:33 GMT
<- Server: Apache
<- Location: https://ebird.org/ws1.1/data/obs/geo_spp/recent?fmt=json&sci=Anas%2520platyrhynchos&lat=39&lng=-121&maxResults=5
<- Content-Length: 312
<- Content-Type: text/html; charset=iso-8859-1
<- X-OSSProxy: OSSProxy 1.3.337.412 (Build 337.412 Win32 en-us)(Jan 11 2018 14:07:40)
<- Connection: keep-alive
<-
-> GET /ws1.1/data/obs/geo_spp/recent?fmt=json&sci=Anas%2520platyrhynchos&lat=39&lng=-121&maxResults=5 HTTP/1.1
-> Host: ebird.org
-> User-Agent: libcurl/7.59.0 r-curl/3.2 httr/1.3.1
-> Accept-Encoding: gzip, deflate
-> Accept: application/json, text/xml, application/xml, /
->
<- HTTP/1.1 400 400
<- Date: Tue, 05 Jun 2018 13:39:33 GMT
<- Server: Apache
<- Content-Encoding: gzip
<- Content-Type: application/json;charset=utf-8
<- Content-Length: 96
<- Connection: close
<-
[1] NA
Warning message:
In ebird_GET(url, args, ...) : Unknown species: Anas%20platyrhynchos
``

I tried it using the v0.4.0 in rstudio (windows) and with linux Rscripts, same issue when using the spocc package.
Do you know if it's a wrong use of the function or a bug with the request ?
Thank for your help

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions