Post matrix from R

Hi, I am hoping to use Openrouteservice from R. What is the magic invocation to make this work? I have tried the following:

library(curl)
library(magrittr)
new_handle() %>%
handle_setopt(copypostfields =
“locations=[[9.70093,48.477473],[9.207916,49.153868]]”) %>%
handle_setheaders(“Content-Type”=“application/json”,
“charset”=“utf-8”,
“Accept”=“application/json, application/geo+json, application/gpx+xml, img/png”,
“charset”=“utf-8”,
“Authorization”=“xxx”) %>%
curl_fetch_memory(url = “https://api.openrouteservice.org/v2/matrix/driving-car”) %$% content %>%
rawToChar %>% jsonlite::prettify()

But this returns error code 500 server error. What am I doing wrong?

Many thanks.

Hi @Michel_de_Lange,

Are you using the openrouteservice-r package already?

Best regards

I didn’t know about the openrouteservice-r package. Just what I need, thank you!
With best regards,
Michel