Topics

How to do Multipart payload with content type specified for each part

Nathaniel Slater <nateslate@...>
 

I need to send a request that looks like the following, but I cannot figure out how to construct the payload properly with the rest-client:

headers: {
'X-DocuSign-Authentication': dsAuthHeader,
'content-type': 'multipart/form-data'
},
multipart: [{
'Content-Type': 'application/json',
'Content-Disposition': 'form-data',
body: JSON.stringify(data),
}, {
'Content-Type': 'application/pdf',
'Content-Disposition': 'file; filename="' + documentName + '"; documentId=1',
body: fs.readFileSync(documentName),
}],

Any advice would be greatly appreciated.

Thanks,
Nate