I have a chrome extension that is using backendless to upload a file. The code is :
var request = new XMLHttpRequest();
request.open('POST', 'https://api.backendless.com/<API-KEY-OBSCURED>/<REST_API_KEY_OBSCURED>/files/binary/testName.webm?overwrite=true');
request.setRequestHeader('Content-Type','multipart/form-data; boundary=RECORD_BOUNDARY');
request.onload = function() {
// Do Something
};
var recorderBlob = { body: recorder.getBlob(), name: "testName.webm" };
request.send(recorderBlob);
// recorder.getBlob is a video/webm object containing a recorded screen
But the response returns a 400 with the following :
response = “{“code”:8002,“message”:“Could not parse request with message: Unexpected end of input, status code 400, headers POST /D5F0DFFA-0C36-CC73-FF39-171676325B00/A2C876F2-6E9C-EE22-FF0E-7C00506E6700/files/binary/testName.webm?overwrite=true”,“errorData”:{}}”
The documentation for the binary file upload does not describe what to do with the ‘boundary’ directive, but the API seems to need it.
I think it is an error in the documentation. I see the Example section here uses the following: Content-Type: text/plain. Could you please try making that change and see if it works for you?
the example you showed actually shows that it needs a PUT rather than a POST. When using a PUT rather than a POST with that content type, the response returns the 200 with the url to the file.