Connecting to R Studio

I am trying to connect to SugarCRM to analyze data via R Studio but am not having any luck. I have been trying to use the REST API directions to get a token but it errors out.

{
"grant_type":"password",
"client_id":"sugar",
"client_secret":"",
"username":"xxxxxxx",
"password":"xxxxxxx",
"platform":"base"
}