Closed samwata closed 11 months ago
From the error we are getting when trying to connect to ONA, it seems there is a connection error when trying to reach the ONA Data API, specifically, something about the TLS version. I found some information about this error here.
You can find the R script being used to call the API here. Specifically, the endpoint being used by the onaDownload
function looks like this: https://api.ona.io/ <account>/forms/<formName>/<form.json> or <data.csv>
I'm going to close this issue for now since its been open for over a year and there is no work that is currently being put into addressing it.
A workaround:
library(httr)
library(jsonlite)
api_token <- "your api token"
form_id <- "your form id"
api_url <- paste0("https://api.ona.io/api/v1/data/", form_id)
headers <- c(
Authorization = paste("Token", api_token)
)
response <- GET(api_url, add_headers(.headers=headers))
if (http_status(response)$category == "Success") {
response_data <- fromJSON(content(response, "text"))
} else {
cat("API request failed with status:", http_status(response)$reason, "\n")
}
I am getting the attached error when I try to import data into R
Steps to reproduce the error