question

batteryshark avatar image
batteryshark asked

Error 500 on file upload

I'm using python to send an upload request - the payload looks like this: -----------------------------7d3e8221-e9c6-4508-b959-be12fea81204 Content-Disposition: form-data; name="metadata" {"kind": "FILE", "name": "usb_network_gate.exe"} -----------------------------7d3e8221-e9c6-4508-b959-be12fea81204 Content-Disposition: form-data; name="content"; filename="file" Content-Type: application/octet-stream THISISMYDATA I'm using \r\n as specified in another thread, but the server always responds with Error 500 even when other functionality works fine (listing directories, getting metadata). Am I doing something wrong?
amazon drive
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

yadayada avatar image
yadayada answered
This is a how an upload of an empty file should look like: send: b'57' send: b'\r\n' send: b'--d042bb63b8a5461aa7213d0c2ae6a064\r\nContent-Disposition: form-data; name="metadata"\r\n\r\n' send: b'\r\n' send: b'4d' send: b'\r\n' send: b'{"name": "actualname", "parents": ["parent_id"], "kind": "FILE"}\r\n' send: b'\r\n' send: b'24' send: b'\r\n' send: b'--d042bb63b8a5461aa7213d0c2ae6a064\r\n' send: b'\r\n' send: b'40' send: b'\r\n' send: b'Content-Disposition: form-data; name="content"; filename="thisisirrelevant"\r\n' send: b'\r\n' send: b'2a' send: b'\r\n' send: b'Content-Type: application/octet-stream\r\n\r\n' send: b'\r\n' send: b'1' send: b'\r\n' send: b'\n' send: b'\r\n' send: b'28' send: b'\r\n' send: b'\r\n--d042bb63b8a5461aa7213d0c2ae6a064--\r\n' send: b'\r\n' send: b'3e' send: b'\r\n' send: b'multipart/form-data; boundary=d042bb63b8a5461aa7213d0c2ae6a064' send: b'\r\n' send: b'0\r\n\r\n' See https://github.com/yadayada/acd_cli/blob/master/acdcli/api/content.py#L125 for the source.
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

batteryshark avatar image
batteryshark answered
I have tried the github link format, but that doesn't seem to work, either. I'm afraid I also don't understand the response above as everything is broken down and rather difficult to read. Is there a simpler example? Also, is there anything that should be in the header besides the authorization? Message was edited by: batteryshark
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Jamie Grossman avatar image
Jamie Grossman answered
Hi there, Thanks for posting. The above response should be able to solve your issue, but if you're still having issues, please do not hesitate to contact the team directly at clouddrive-api-support@amazon.com for further assistance. Regards, Jamie
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.