HTTR GET request error: Failed writing received data to disk/application

Viewed 125

I am trying to send the following API GET Request with the HTTR library in R:

GET('https://api.vitaldb.net/afd182c102c5af625d3f217280b3766d453d9e3f')

But I get the following error message

Error in curl::curl_fetch_memory(url, handle = handle) : Failed writing received data to disk/application

I have tested the specific endpoint in Postman where I am able to retrieve the corret data, but somehow the R command doesn't work.

Can anyone help me?

1 Answers

According to the API docs the file is GZip-compressed CSV format so you could do the following (though someone might know of a one-liner download and read)

library(data.table)

download.file(url = "https://api.vitaldb.net/afd182c102c5af625d3f217280b3766d453d9e3f.csv.gz",
              destfile = file.path("data.csv.gz"))

d <- fread("data.csv.gz", sep = ',')
Related