Getting 400 reasons for a bad request: required from google cloud stoarge json api

I am trying to upload a file (png in this example) to Google Cloud Storage, but my request failed with a subsequent 400 Bad Request response.

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

My POST request is as follows.

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 documentation I provided the necessary parameters, etc., so I do not see what is requiredthat I'm not providing.

+4
source share
1 answer

You forgot to specify the parameter namein the URL. See the Easy Download documentation for more information .

+6
source

Source: https://habr.com/ru/post/1544660/


All Articles