I am using the Box API from within a C++ application using Qt. Using the Qt library (QNetworkAccessManager, QHttpMultiPart, etc...), I am able to sign in, authenticate, get file listing and file content. However I have hit a road block with trying to upload a new file. All I get from the server is "400 Bad request" with no other message. If anyone can spot my mistake, I would really appreciate it! I've checked that the parent ID is correct and valid.
Here is (an example of) the raw request that I am sending out (the auth token is not shown for security):
POST /api/2.0/files/content HTTP/1.1
Authorization: Bearer XXXXXXXXXXXXXXXXXX
Content-Type: multipart/form-data; boundary="boundary_.oOo._MTA5NjYzOTY0Ng==MTUxNzg3MTc2OA==OTEyNTYyMDYz"
MIME-Version: 1.0
Content-Length: 411
Connection: Keep-Alive
Accept-Encoding: gzip, deflate
Accept-Language: en-US,*
User-Agent: Mozilla/5.0
Host: upload.box.com
--boundary_.oOo._MTA5NjYzOTY0Ng==MTUxNzg3MTc2OA==OTEyNTYyMDYz
Content-Disposition: form-data; name="attributes"
{"name":"test.json", "parent":{"id":"5***phone number removed for privacy***"}}
--boundary_.oOo._MTA5NjYzOTY0Ng==MTUxNzg3MTc2OA==OTEyNTYyMDYz
Content-Disposition: form-data; name="file.json"
{
"date": "2018/03/01",
"name": "ABCDEFGHIJKLMNO"
}
--boundary_.oOo._MTA5NjYzOTY0Ng==MTUxNzg3MTc2OA==OTEyNTYyMDYz--