0

I want to read in data from an API to R using jsonlite, but gives me the error message shown below. Before some months, it was working fine. What could be the reason that it is not working now? I am trying to get data from the openFDA API:

    library(jsonlite)
    fda=fromJSON("https://api.fda.gov/drug/event.json?search=receivedate:[20040101+TO+20160101]&count=receivedate")
           Error in open.connection(con, "rb") : 
           Peer certificate cannot be authenticated with given CA certificates
Fisseha Berhane
  • 2,533
  • 4
  • 30
  • 48
  • I just ran your code successfully w/o an issue. I am using Mac OS X 10.10.5 (Yosemite), R version 3.2.3 (2015-12-10), and jsonlite_0.9.19. Have you tried this after restarting your R session? – steveb Apr 09 '16 at 00:52
  • SSL issue, may you try with http instead or check if you can access the site without being block by browser due to SSL error. – Sinh Nguyen Apr 09 '16 at 01:35
  • Thank you for checking it it for me. I recently started using Microsoft R open for multi-threaded performance and that was the reason. Now, after I switched back tot the base R, it works fine. – Fisseha Berhane Apr 09 '16 at 01:41
  • you may want to checkout the https://github.com/rOpenHealth/openfda package – sckott Apr 09 '16 at 03:22

0 Answers0