Hi there, one question on how to pass parameter to the REST API REQUEST.
I already got the token and I want to am using R, to retrieve data from REST API, by passing the parameters. the following is my code
# once get the token, retrieve the data
library(httr)
r <- POST("https://XXXXXXXX/api/locationhazardInfo",
add_headers("Content-Type"="text/plain; charset=UTF-8",
Accept="text/plain",
"Authorization"=paste("Bearer", tok)),
body = list(
"Latitude":40.738269,
"Longitude":-74.02826,
"CountryCode":"USA",
"HazardLayers":[
{
"LayerId":"18",
"Description":""
},
{
"LayerId":"6",
"Description":""
}
],
"Distances":[
{
"Value":1,
"Unit":"miles"
}
]
)
)
The tok is the token I got from previous step. And I got the systen errors (seem all syntax erros) as shown below,
Can someone give me some idea on what might cause the issue and the resolution? Any input is greatly appreciated. Thanks.