Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting 400 bad request reason:required from google cloud stoarge json api

I am attempting to upload a file (png in this this example) to google cloud storage but my request fails with the following 400 Bad Request response.

{
 "error": {
  "errors": [
   {
    "domain": "global",
    "reason": "required",
    "message": "Required"
   }
  ],
  "code": 400,
  "message": "Required"
 }
}

My POST request looks like this.

POST https://www.googleapis.com/upload/storage/v1/b/unit_tests/o?uploadType=media HTTP/1.1
Accept: application/json, text/json, text/x-json, text/javascript
Authorization: OAuth XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Content-Type: image/png
Host: www.googleapis.com
Transfer-Encoding: chunked
Expect: 100-continue
Accept-Encoding: gzip, deflate
Connection: Keep-Alive

96DA5
�PNG

���
IHDR����������e�����sRGB�������gAMA����
�a���   pHYs�������o�d����IDATx^�|W��?o��������������,Y`I

*** FIDDLER: RawDisplay truncated at 128 characters. Right-click to disable truncation. ***

Per the documentation I've supplied the necessary paramters etc so I cannot see what is required that I am not providing.

like image 629
dkackman Avatar asked Jun 15 '14 17:06

dkackman


1 Answers

You forgot to supply the name parameter in the URL. See the Simple upload documentation for more details.

like image 61
jterrace Avatar answered Sep 26 '22 01:09

jterrace