Have a look at this question: POSTing a file to a https REST service
POSTing multipart form data isn't possible with the platform without an App Store module. This will be included in the platform in the near future. You can use the REST Services module from the App Store to send multipart form data.
Here is a link to the documentation of the REST Services module: Consuming operations that work with files
21-11-2016:
After gaining access to a test project, this is what the request looks like:
--7AS5qM4ES3qmVzcwmGL8LZoS8BTkvuPSdIuKf1
Content-Disposition: form-data; name="{FILENAME_UPLOADED_IMAGE}"; filename="{FILENAME_UPLOADED_IMAGE}"
Content-Type: application/octet-stream; charset=ISO-8859-1
Content-Transfer-Encoding: binary
BINARY
--7AS5qM4ES3qmVzcwmGL8LZoS8BTkvuPSdIuKf1
Content-Disposition: form-data; name="Thumbnail_Image"
Content-Type: application/octet-stream; charset=ISO-8859-1
Content-Transfer-Encoding: binary
BINARY
--7AS5qM4ES3qmVzcwmGL8LZoS8BTkvuPSdIuKf1
Content-Disposition: form-data; name="PublicThumbnailPath"
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
null
--7AS5qM4ES3qmVzcwmGL8LZoS8BTkvuPSdIuKf1
Content-Disposition: form-data; name="__UUID__"
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
3bdf5104-38cb-4a31-b71e-67a6c8513211
--7AS5qM4ES3qmVzcwmGL8LZoS8BTkvuPSdIuKf1
Content-Disposition: form-data; name="TestImage_LightspeedSettings"
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
null
--7AS5qM4ES3qmVzcwmGL8LZoS8BTkvuPSdIuKf1
Content-Disposition: form-data; name="LightspeedID"
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
59
--7AS5qM4ES3qmVzcwmGL8LZoS8BTkvuPSdIuKf1
Content-Disposition: form-data; name="__FileName__"
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
1
--7AS5qM4ES3qmVzcwmGL8LZoS8BTkvuPSdIuKf1--
while it should look like:
POST /API/Account/{id}/Item/{id}/Image Accept: application/xml Content-Type: multipart/form-data; boundary=25112bca3fa7474e9874f9e8654c27aa --25112bca3fa7474e9874f9e8654c27aa Content-Disposition: form-data; name="data" <Image> <filename>2014 red racer.jpg</filename> <description>Our new 2014 Racer model in Red!</description> </Image> --25112bca3fa7474e9874f9e8654c27aa Content-Disposition: form-data; name="image"; filename="2014 red racer.jpg" Content-Type: image/jpeg .... Image data .... --25112bca3fa7474e9874f9e8654c27aa--
in case anybody needs this in the future. I changed the java file and added the code below just before the call to client.executeMethod(request);. I have to admit that this is kind of dirty, since you shouldn't directly write to System.out
if (request instanceof PostMethod) {
PostMethod pm = (PostMethod)request;
pm.getRequestEntity().writeRequest(System.out);
}
int status = client.executeMethod(request);
22-11-2016:
So it seems that what you are trying to achieve isn't possible without modifying the REST module