We are trying to do a multi part form post that sends a byte array similar to the following:
headers:
X-ApiKey: xxxxxxxx
Content-Type: multipart/form-data; boundary=----SomethingUnique12345
Using restler, I tried putting something together such as the following:
restler.post(configuration.rec_v14.root_service_end_point +"candidates/xxxxxx/documents", {
multipart: true,
headers: {
'Content-Type' : 'multipart/form-data;',
However, this did not work.
So, I have a few questions that the documentation does not answer.
First, The first part of the payload specifies a content-type. Looking at restler, I am not sure if there is a way to do that.
Second, when I run the example above, I get a message stating "Building multipart request without Content-Length header, please specify all file sizes". When I look at the examples, It only see the content length specified for a reslter.file method and not the restler.data method.
Third, It is not clear on how to specify boundary. I am assuming it is done for me but I am not sure.
We are trying to do a multi part form post that sends a byte array similar to the following: headers: X-ApiKey: xxxxxxxx Content-Type: multipart/form-data; boundary=----SomethingUnique12345
payload: ------SomethingUnique12345 Content-Type: application/json
{file_name: "file.docx", document_type:"Resume",description:"Example"} ------SomethingUnique12345 Content-Type: application/vnd.openxmlformats-officedocument.wordprocessingml.document
(byte array) ------SomethingUnique12345—
Using restler, I tried putting something together such as the following: restler.post(configuration.rec_v14.root_service_end_point +"candidates/xxxxxx/documents", { multipart: true, headers: { 'Content-Type' : 'multipart/form-data;',
xxxxxxxxx }, data: { 'boundary[message]': { "file_name":"file.docx", "document_type":"Resume", "description":"example }, 'boundary[file]': restler.data('file.docx', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', byte array) } }).on('complete', function(data) { console.log(data); });
However, this did not work. So, I have a few questions that the documentation does not answer. First, The first part of the payload specifies a content-type. Looking at restler, I am not sure if there is a way to do that. Second, when I run the example above, I get a message stating "Building multipart request without Content-Length header, please specify all file sizes". When I look at the examples, It only see the content length specified for a reslter.file method and not the restler.data method. Third, It is not clear on how to specify boundary. I am assuming it is done for me but I am not sure.
Any assistance in with this would be appreciated.