INVALID_CONTENT_TYPE when creating an envelope
Closed this issue · 2 comments
ihteandr commented
I want create the envelop but get this
'{\r\n "errorCode": "INVALID_CONTENT_TYPE",\r\n "message": "Content Ty
pe specified is not supported."\r\n}' }
this is the code
var CRLF = '\r\n';
var form = new FormData();
var filename = "test.pdf";
var documentId = Date.now();
var recipientId = settings.accountID;
var json_data_options = {
header: CRLF + '--' + form.getBoundary() + CRLF + 'Content-Type: application/json' + CRLF
};
for(var key in args.signers){
args.signers[key].recipientId = recipientId;
}
var json_data = {
"status":"sent",
"emailBlurb":"Test Email Body",
"emailSubject": "Test Email Subject - EnvelopeDefFull",
"documents": [{
"name": filename,
"documentId": documentId,
"order":"1"
}],
"recipients": {
"signers" : args.signers
}
};
form.append("form-data", JSON.stringify(json_data), json_data_options);
var file_options = {
header: CRLF + '--' + form.getBoundary() + CRLF + 'Content-Type: application/pdf' + CRLF
};
form.append('file: filename="' + filename + '";documentId='+ documentId, args.file, file_options);
var options = {
method: "POST",
uri: settings.baseUrl + "/accounts/" + settings.accountID + "/envelopes",
headers: {
"X-DocuSign-Authentication": JSON.stringify({
Username: settings.username,
Password: settings.password,
IntegratorKey: settings.integrationKey
}),
"Accept": "application/json",
"Content-Type": "multipart/form-data; boundary=" + form.getBoundary()
},
form: form
};
return new Promise(function(resolve, reject){
request(options, function(error, response, body){
if (!error && response.statusCode == 200) {
resolve(JSON.parse(body));
} else {
error = {
error: error,
response: response,
body:body
};
reject(error);
}
});
});
what can be a problem?
I try add the accountID into headers but it doesn't help
jondkinney commented
@ihteandr Sorry for the late reply. Are you using the version from rubygems? Or the master branch? I need to get a new gem version pushed to rubygems, but in the mean time if you point to the master branch in your Gemfile, does this same error still happen?
recurrence commented
This seems stale at this point, recommend close.