Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7847051
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T17:46:39+00:00 2026-06-02T17:46:39+00:00

Need help regarding inserting a file to google drive through api. The api documentation

  • 0

Need help regarding inserting a file to google drive through api. The api documentation for this purpose does not clearly explains how to send the actual body of the file through http post request.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T17:46:40+00:00Added an answer on June 2, 2026 at 5:46 pm

    The documentation on insert operations already contains examples in a bunch of programming languages, here is how to do it using the HTTP based protocol of the Google Drive API.

    First, POST the new file metadata to the Drive endpoint. It has to be in the form of a File resource JSON object:

    POST /drive/v2/files HTTP/1.1
    Host: www.googleapis.com
    Authorization: Bearer <OAuth 2.0 access token here>
    ...
    
    {
      "title": "file_name.extension",
      "mimeType": "mime/type",
      "description": "Stuff about the file"
    }
    

    The response body will be a JSON representation of the newly created File resource. It will look like:

    {
      "kind": "drive#file",
      "id": string,
      "etag": etag,
      "selfLink": string,
      "title": "file_name",
      "mimeType": "mime/type",
      "description": "Stuff about the file"
      ...
      "downloadUrl": string,
      ...
    }
    

    This is a confirmation that the file entry has been created. Now you need to upload the content. To do that you need to take the ID of the file given by the id JSON attribute in the response above and PUT the content of the actual file to the upload endpoint with an OAuth 2.0 authorized request. It should look like:

    PUT /upload/drive/v2/files/{id}?uploadType=media HTTP/1.1
    Host: www.googleapis.com
    Authorization: Bearer <OAuth 2.0 access token here>
    Content-Type: mime/type
    
    <file content here>
    

    You are done 🙂

    There is also a way to do this in 1 single POST request using a multipart request where you post the metadata of the file at the same time as the content. Here is an example:

    POST /upload/drive/v2/files HTTP/1.1
    Host: www.googleapis.com
    Authorization: Bearer <OAuth 2.0 access token here>
    Content-Type: multipart/form-data; boundary=287032381131322
    ...
    
    --287032381131322
    Content-Type: application/json
    
    {
      "title": "file_name.extension",
      "mimeType": "mime/type",
      "description": "Stuff about the file"
    }
    --287032381131322
    Content-Type: mime/type
    
    <file content here>
    --287032381131322--
    

    The response will contain the metadata of the newly created file.
    You may also use the Content-Transfer-Encoding: base64 header in the sub-part of the request to be able to pass the data of the file as Base 64 encoded.

    Lastly there is also a resumable upload protocol which is convenient to upload large files, offer a pause/resume feature and/or upload files with flaky internet connection.

    PS: most of this is now described in Drive’s file upload documentation.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need some help regarding the arrays in Perl This is the constructor I
Need help regarding the color codes for buttons in HOLO DARK theme ICS. This
I am new to Jquery and Javascript. Need a help regarding this problem: There
I need a help regarding sound file encryption/decryption. I would like to encrypt a
I need help regarding array insertion into mysql table. I have an array when
need help regarding USSD Gateway. I have to develop an app, which will directly
I need help regarding DDA algorithm , i'm confused by the tutorial which i
I need help regarding JOIN tables to get category name & author name from
I need some help regarding algorithm for randomness. So Problem is. There are 50
i need ur help regarding web services in classic asp here is my code

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.