I am trying to upload call recordings on hubspot and create association to the related contacts using rails but getting errors.
Here is the script:
api_url = “https://api.hubapi.com/crm/v3/objects/calls”
url = recording_url
body = {
“properties”: {
"hs\_timestamp": "2021-03-17T01:32:44.872Z",
"hs\_call\_title": "Discovery call",
"hubspot\_owner\_id": "11349275740",
"hs\_call\_body": " testing",
"hs\_call\_from\_number": "23194159",
"hs\_call\_to\_number": "25302229",
"hs\_call\_recording\_url": url,
"hs\_call\_status": "COMPLETED"
},
“associations”: [
{
"to": {
"id": 179552
},
"types": \[
{
"associationCategory": "HUBSPOT\_DEFINED",
"associationTypeId": 193
}
]
}
]
}
response = RestClient.post(api_url, body, headers: {‘Content-Type’ => ‘application/json’,‘Authorization’=> “Bearer #{ENV[‘HUBSPOT_ACCESS_TOKEN’]}” })
and with abive script I am getting followign error:
RestClient::UnsupportedMediaType: 415 Unsupported Media Type