restfile-uploadgoogle-drive-apipostmanmultipart

How to upload file to Google drive with Postman using multipart?


How could I upload file to Google Drive using Google Drive API with Postman?

I also want to set file's name and parent directory.

What have I done:

I try to upload file with following properties:

enter image description here

enter image description here

enter image description here

But I get 403 error:

{
    "error": {
        "errors": [
            {
                "domain": "global",
                "reason": "parseError",
                "message": "Parse Error"
            }
        ],
        "code": 400,
        "message": "Parse Error"
    }
}

Solution

  • I have resolved my problem, using answer on this question: How to send application/json data along with file in postman multipart/form-data post request?.

    Solution

    1) create file for upload to Google Drive: test.txt;

    2) create file upload-options.json with file's metadata properties in json format:

    {
      "name": "my-uploaded-file.txt",
      "parents": ["<parent-directory-id>"]
    }
    

    3) add two form-data fields: