# Post matrix from R

**URL:** <https://ask.openrouteservice.org/t/post-matrix-from-r/1963>\
**Category:** matrix\
**Created:** [July 30, 2020, 4:22am UTC](https://ask.openrouteservice.org/t/post-matrix-from-r/1963 "2020-07-30T04:22:48Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![Michel\_de\_Lange](https://ask.openrouteservice.org/user_avatar/ask.openrouteservice.org/michel_de_lange/32/574_2.png) [@Michel\_de\_Lange](https://ask.openrouteservice.org/u/Michel_de_Lange)\
**Post date:** [July 30, 2020, 4:22am UTC](https://ask.openrouteservice.org/t/post-matrix-from-r/1963/1 "2020-07-30T04:22:48Z")

</div>

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](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.

---

_[View the full topic](https://ask.openrouteservice.org/t/post-matrix-from-r/1963)._
