I'm trying to do a GET request by connecting to a REST API. I'm pretty new on how to handle API's. I was given an API token and a password for authentication purposes. I'm using R and Python both to connect but failing in both. I've used the basic code below in R :
library(httr)
library(jsonlite)
token<- 'XXX'
password<- 'XXX'
r1 <-GET("https://api.****.com/v1/Reporting/BalanceSheet/? query parameters"
, add_headers(token,password))
r1
In the above code in place '****' I have the website name and all parameters mentioned instead of 'quers parameters'. When I run the 5th line of code it throws me the below error:
Error in curl::curl_fetch_memory(url, handle = handle) :
URL using bad/illegal format or missing URL
I'm not sure how to use the token and it's purpose...I'm more like assuming it to be the username.
Any lead would be appreciated. Thanks.