Hi All,
I am trying to create opportunities using the following script but am getting 415 errors, "message":"Missing or invalid Content-Type header". I have checked the headers and they look good! Any ideas where I'm going wrong?
function myCapsule() {
var url = '
https://example.capsulecrm.com/api/party/111111111/opportunity';
var data =
{
"opportunity": {
"name": "From Google Apps",
"partyId": "1111111111",
"milestone": "Milestone"
}
};
var payload = JSON.stringify(data);
var headers = {
'Content-type': 'application/json',
'Authorization': 'Basic '+ Utilities.base64Encode('apikey:a-letter')
};
var options =
{
'headers' : headers,
'method' : 'post',
'payload' : payload
};
var capsulePost = UrlFetchApp.fetch(url, options);