This url works in the browser, providing some JSON data.
It worked from R until very recently, it now returns:
library(jsonlite)
fromJSON("https://api.worldbank.org/v2/country?format=json")
# Error in open.connection(con, "rb") :
# SSL certificate problem: certificate has expired
library(rvest)
read_html("https://api.worldbank.org/v2/country?format=json")
# Error in open.connection(con, "rb") :
# SSL certificate problem: certificate has expired
I am not sure if this is an issue on the API side, or somewhere in R?
For anyone else who is having a similar issue
The website owner had an expired SSL certificate.
I was able to confirm this via this website:
Since I have no control over the url's SSL certificate, I simply changed all the urls I was using from https
to http
.
For example:
"https://api.worldbank.org/v2/country?format=json"
changes to
"http://api.worldbank.org/v2/country?format=json"