ALA4R icon indicating copy to clipboard operation
ALA4R copied to clipboard

problem accessing records using occurrences()

Open terraignisaura opened this issue 5 years ago • 6 comments

On running the following R code, i receive an error that includes a HTTP "301 Moved" server error. I first received on 12/03/2019. I was using the same code on 11/03/2019 with no issue. I assume some server changes or updates are causing this.

query <- sprintf("taxon_name:"%s"", species) temp <- occurrences(taxon=query,download_reason_id=4, use_data_table=TRUE) Error in parse_con(txt, bigint_as_char) : lexical error: invalid char in json text.

301 Moved (right here) ------^

do you require more detail?

terraignisaura avatar Mar 13 '19 01:03 terraignisaura

I have temporarily created a workaround at my end, but hoping a solution is found soon given how extremely useful this library is.

Regards

terraignisaura avatar Mar 13 '19 04:03 terraignisaura

I am having the same issue with this code

d <- data.frame(ala_fields("layers"))

Receiving the same error message. Would you mind sharing your workaround? Thank you

meridyp avatar Mar 14 '19 00:03 meridyp

I am no longer maintaining ALA4R so this isn't an official reply (!) but the issue appears to be that the servers have changed to secure https://.... So when ALA4R sends its queries via http://... they are being redirected at the server end to the secure address, but ALA4R isn't following the redirection. One possible workaround would be to:

  • clone the ALA4R repository to your local computer
  • edit the R/onload.R script, changing the relevant http://... entries to https://...
  • use devtools::load_all to load the package, rather than library(ALA4R)

That is admittedly rather a complicated workaround so hopefully the maintainers can confirm my diagnosis and fix the issue soon. I would do it but I am not sure if all endpoints have changed to https, or only some, so I might end up breaking more than I fix ...

raymondben avatar Mar 14 '19 00:03 raymondben

Thanks very much Ben, I will give that a go!

meridyp avatar Mar 14 '19 01:03 meridyp

Cheers Ben, and thanks for raising the issue all. There were some changes especially to the spatial services, and Ben is right about the https. I'm running some testing on all of the endpoints now and I'll get a new version up as soon as I can.

peggynewman avatar Mar 14 '19 04:03 peggynewman

Hi all, I've updated ALA4R with quite a big change to remove the dependency on the older RCurl library in the backend, and now use httr. The tests all now run successfully and the new builds (1.7.0) are working their way through CRAN. So you can install from the github master now, or wait another few days for the installation to come through CRAN.

The ALA tightened security on everything to a minimum of TLS1.2 which meant that machines using older security protocols got locked out. httr works around this problem.

Thanks very much for reporting the issue. Let me know if anything comes up for you in the new version.

Cheers Peggy

peggynewman avatar Apr 02 '19 22:04 peggynewman