Hello!
I am having issues to get data from an API within RStudio.
I am declaring the API key in the environment via Sys.setenv, then calling GET and getting the following error: Error in curl::curl_fetch_memory(url, handle = handle) :
schannel: next InitializeSecurityContext failed: SEC_E_INVALID_TOKEN (0x80090308) - The token supplied to the function is invalid
When trying in the browser, the query and the key work perfectly.
R code:
library(httr)
library(jsonlite)
library(curl)
set_config(use_proxy(url = "mycompanyproxy", username = "XX", password = "XX"))
Sys.setenv(TIINGO_TOKEN = "myapikey")
data <- httr::GET("https://api.datalastic.com/api/v0/vessel_history",
httr::add_headers(Authorization="TIINGO_TOKEN"),
query = list("imo" = 9925253,"from"="2024-06-01","to"="2024-07-01")
)
THANKS FOR THE HELP!