AnsweredAssumed Answered

Multi-part POST

Question asked by ramakantjoshi on Jun 8, 2016


I'm trying to do a multi-part POST using the REST step. The POSt involves 2 files

a. an XML file

b. a zip file

 

I tried using the filePath

eg.

------FormBoundary

Content-Disposition: form-data; name="payload.xml"; filename="mypayload.xml"

Content-Type: text/xml

------FormBoundary

Content-Disposition: form-data; name="mypayload.xml"

file:///C:///LisaProjects/Data/upload/mypayload.xml

------FormBoundary

Content-Disposition: form-data; name="payload.zip"; filename="mypayload.zip"

Content-Type: application/zip

------FormBoundary

Content-Disposition: form-data; name="mypayload.zip"

 

file:///C:///LisaProjects/Data/upload/mypayload.zip

------FormBoundary--

 

The file path doesn't seem to work. So, I added 2 steps before the REST call to essentially read the file content (and set a filter) using the Read a File step. So now, my POST body looks like

------FormBoundary

Content-Disposition: form-data; name="payload.xml"; filename="mypayload.xml"

Content-Type: text/xml

------FormBoundary

Content-Disposition: form-data; name="mypayload.xml"

 

{{payloadXml}}

------FormBoundary

Content-Disposition: form-data; name="payload.zip"; filename="mypayload.zip"

Content-Type: application/zip

------FormBoundary

Content-Disposition: form-data; name="mypayload.zip"

 

{{payloadZip}}

 

------FormBoundary--

 

The XML gets posted just fine, but I get a response from the service that the ZIP is not in the right format. It's a valid zip for sure. I tried converting to a byte array. I'm missing something obvious. Comments?

Outcomes