java - Dailymotion upload error "no content" -


i'm developping web application capable of upload video on dailymotion find during 1 years , have seen error occuring when upload video on dailymotion.

{ "error": "missing content" "seal": "540f4ad5a0f9c6a7e85a46be98361581" } 

i use java , lib "org.apache.http" doing call on dailymotion.

my code :

path temp = files.createtempfile(multipartfile.getname(), "." + suffix);             multipartfile.transferto(temp.tofile());             multipartentitybuilder builder = multipartentitybuilder.create();             builder.setmode(httpmultipartmode.browser_compatible);             builder.addpart(multipartfile.getoriginalfilename(), new filebody(temp.tofile(),                     contenttype.application_octet_stream, multipartfile.getoriginalfilename()));             httppost.setentity(builder.build());             try (closeablehttpclient httpclient = httpclients.createdefault();                     closeablehttpresponse response = httpclient.execute(httppost);) {                 httpentity entity = response.getentity();                 objectmapper mapper = new objectmapper();                 dailymotionuploadvideoresponse dmuploadresponse = mapper.readvalue(entity.getcontent(),                         dailymotionuploadvideoresponse.class);                 // delete temp file after upload                 files.deleteifexists(temp);                 if (dmuploadresponse.geterror() != null) {                     throw new dailymotionjsonexception(dmuploadresponse.geterror().getmessage());                 }                 entityutils.consume(entity);                 response.close(); 

post on url retrieve dailymotion :

http://upload-12.dc3.dailymotion.com/upload?uuid=035e365c5b2355616e381f43c1b2b391&seal=edad1d3ad9e348c65e975582571e5815 

header of post request :

content-disposition: form-data;  name="2015-07-16-192550-1.webm";  filename="2015-07-16-192550-1.webm",  content-type: application/octet-stream,  content-transfer-encoding: binary 

i don't understand why i'm doing wrong.

i test via curl , have same error.

content-type: multipart/form-data; boundary=----webkitformboundaryimx1443wqzzbf0fb content-length: 1398401 source message  post /upload?uuid=035e365c5b2355616e381f43c1b2b391&seal=edad1d3ad9e348c65e975582571e5815 http/1.1  host: upload-12.dc3.dailymotion.com  content-type: multipart/form-data; boundary=----webkitformboundaryimx1443wqzzbf0fb  content-length: 1398401   ------webkitformboundaryimx1443wqzzbf0fb  content-disposition: form-data; name="2015-07-16-192550-1.webm"; filename="2015-07-16-192550-1.webm"  content-type: video/webm 

api dailymotion have changed, change code

builder.addpart(multipartfile.getoriginalfilename(), new filebody(temp.tofile(),                     contenttype.application_octet_stream, multipartfile.getoriginalfilename())); 

by :

builder.addpart("file", new filebody(temp.tofile(),                         contenttype.application_octet_stream, multipartfile.getoriginalfilename())); 

Comments

Popular posts from this blog

sql - invalid in the select list because it is not contained in either an aggregate function -

Angularjs unit testing - ng-disabled not working when adding text to textarea -

How to start daemon on android by adb -