question

jsourcen avatar image
jsourcen asked

Internal failure message on Upload File Action

When i try to upload a file from my PHP application using REST API... am getting this response from Amazon. Can someone tell what does this means ? object(stdClass)#3 (1) { ["message"]=> string(16) "Internal failure" } Thanks,
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.

Shane Dickson avatar image
Shane Dickson answered
Most of the time, that error means you you've not formatted the request properly. The upload file method is notorious for being a little difficult to get right, since you have to formulate your POST http body just right.
10 |5000

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

jsourcen avatar image
jsourcen answered
Thank you shane for your reply... am trying the same but no success with it... i was able to list, create folder, delete items etc... but unable to upload anything! This is how am trying... array( 'name' => 'testupload', 'content' => array( 'kind' => 'FILE', 'name' => 'hi.jpg', 'parents' => $parents ) ) ); $fields_string = json_encode($fields); $httpheader = array( 'Authorization: Bearer '.$this->access_token ); //open connection $ch = curl_init(); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_HTTPHEADER, $httpheader); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_HEADER, 1); curl_setopt($ch, CURLOPT_POST, count($fields)); curl_setopt($ch, CURLOPT_POSTFIELDS, $fields_string); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE); $result = curl_exec($ch); ?> This is what the output i get all the time...: string(275) "HTTP/1.1 500 Internal Server Error Content-Type: application/vnd.error+json Date: Tue, 08 Sep 2015 04:11:50 GMT Server: Amazon-Cloud-Drive x-amzn-RequestId: 69526b50-7532-4391-8260-65652a8a9e8b Content-Length: 30 Connection: keep-alive {"message":"Internal failure"}" Unable to upload file ! Am failing on forming the json i guess !
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. Our requirement for payload is multipart/form with: === metadata === 'name' => 'testupload', 'kind' => 'FILE’, 'parents' => $parents === content === In cURL it should look something like this: curl -v -X POST --form 'metadata={"name":"testVideo1","kind":"FILE"}'--form 'content=@sample_iTunes.mp4' ' https://content-na.drive.amazonaws.com/cdproxy/nodes?localId=testVideo1&sup... --header "Authorization: Bearer Atza|IQEBLjAsAhQ5zx7pKp9PCgCy6T1JkQjHHOEzpwIUQM” Please confirm that you're following all of the instructions here: https://developer.amazon.com/public/apis/experience/cloud-drive/content/nodes 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.

jsourcen avatar image
jsourcen answered
Hi, Thank you for helping me out. Am trying for the same and ending up with mistakes... Am getting error like following... string(276) "HTTP/1.1 100 Continue HTTP/1.1 400 Bad Request Content-Type: application/vnd.error+json Date: Fri, 09 Oct 2015 05:41:02 GMT Server: Amazon-Cloud-Drive x-amzn-RequestId: d9187e7f-e8e7-467d-8352-c0df56f88c0e Content-Length: 16 Connection: keep-alive {"message":"{}"}" Unable to upload file ! Unable to do upload action.... but able to do read, delete actions... Thanks,
10 |5000

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

jsourcen avatar image
jsourcen answered
I wrote the issue am facing here detailed... http://stackoverflow.com/questions/33095518/amazon-cloud-drive-api-uploading-file-forming-expected-input-in-php it would be great if someone can help on this... Thank you.
10 |5000

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

Levon@Amazon avatar image
Levon@Amazon answered
Checking the log of the request that you made shows that you were using the 'application/x-www-form-urlencoded' header, which is unsupported. A suggested way is to switch to 'multipart/form-data' instead. Another issue is related to you using a malformed query string. The suppress parameter should be either true or false, while you seem to have passed in 'suppress={suppress}'
10 |5000

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