I'm just starting to get my feet wet in the API waters, and I'm trying to follow along the "Send a simple request" section at this link. When executing
github_api <- function(path) {
url <- modify_url("https://api.github.com", path = path)
GET(url)
}
resp <- github_api("/repos/hadley/httr")
I get the following error message:
Error in curl::curl_fetch_memory(url, handle = handle) : schannel: next InitializeSecurityContext failed: SEC_E_UNTRUSTED_ROOT (0x80090325) - The certificate chain was issued by an authority that is not trusted.
I'm getting similar error messages for most API calls I try to make on my machine, although the call
GET("http://api.open-notify.org/astros.json")
taken from this link happily returns data without issue. Searching google for the error message returns a lot of posts unrelated to R specifically and I'm having trouble determining what troubleshooting steps I can take.
Update
I have tested the call on another machine with success, so there is some setting/configuration/firewall impediment on my main machine which is preventing me from making some, but not all, API calls. This may be related to this issue. Is there a way to determine the root cause here and apply a fix?
I was able to solve this by using a forward proxy which allows my machine to reach sites outside my corporate firewall as follows (I've obscured the url and port for obvious reasons):
proxy <- use_proxy( url = "http://myproxy"
,port = 9999
,auth = "basic")
github_api <- function(path) {
url <- modify_url("https://api.github.com", path = path)
GET(url, proxy)
}
resp <- github_api("/repos/hadley/httr")
Hopefully such a forward proxy exists for anyone else facing this issue.
User contributions licensed under CC BY-SA 3.0