I have been generally able to navigate the API without issue, but I cannot get a file that is in the form of a blob, to attach to the Account record. I am new to programming over web APIs, so I haven't yet figured out a way to capture the corresponding HTTP POST request and response so I am flying a bit blind. Would welcome any ideas on what is going wrong. When I execute the code against a good recordId for an account, I receive the following response:
{code=INVALID_REQUEST, details={}, message=unable to process your request. please verify whether you have entered proper method name, parameter and parameter values., status=error}
//
// Upload a file
function uploadFile(serviceUrl, recordId , fileBlob) {
var Service = getService();
var requestUrl = ZOHO_URL_BASE + serviceUrl + '/' + recordId + '/Attachments';
try {
var response = UrlFetchApp.fetch(requestUrl, {
headers: {
Authorization: 'Bearer ' + Service.getAccessToken(),
},
method: "POST",
'contentType': 'multipart/form-data',
muteHttpExceptions: true,
'payload' : fileBlob
});
var result = JSON.parse(response.getContentText());
Logger.log(result);
Logger.log(result.message);
} catch (error) {
Logger.log(error.toString());
}
}
Thanks!