API Reference

This API reference is organized by resource type. Each resource type has one or more data representations and one or more methods.

Resource types

  1. Files
  2. About
  3. Changes
  4. Children
  5. Parents
  6. Permissions
  7. Revisions
  8. Apps
  9. Comments
  10. Replies
  11. Properties
  12. Channels
  13. Realtime
  14. Drives

Files

For Files Resource details, see the resource representation page.

Method HTTP request Description
URIs relative to https://www.googleapis.com/drive/v2, unless otherwise noted
get GET  /files/fileId Gets a file's metadata by ID.
insert POST
https://www.googleapis.com/upload/drive/v2/files

and
POST  /files
Insert a new file.
patch PATCH  /files/fileId Updates file metadata. This method supports patch semantics.
update PUT
https://www.googleapis.com/upload/drive/v2/files/fileId

and
PUT  /files/fileId
Updates file metadata and/or content.
copy POST  /files/fileId/copy Creates a copy of the specified file.
delete DELETE  /files/fileId Permanently deletes a file by ID. Skips the trash. The currently authenticated user must own the file or be an organizer on the parent for shared drive files.
list GET  /files Lists the user's files.
touch POST  /files/fileId/touch Set the file's updated time to the current server time.
trash POST  /files/fileId/trash Moves a file to the trash. The currently authenticated user must own the file or be at least a fileOrganizer on the parent for shared drive files.
untrash POST  /files/fileId/untrash Restores a file from the trash.
watch POST  /files/fileId/watch Start watching for changes to a file.
emptyTrash DELETE  /files/trash Permanently deletes all of the user's trashed files.
generateIds GET  /files/generateIds Generates a set of file IDs which can be provided in insert or copy requests.
export GET  /files/fileId/export Exports a Google Doc to the requested MIME type and returns the exported content. Please note that the exported content is limited to 10MB.

Required query parameters: mimeType

About

For About Resource details, see the resource representation page.

Method HTTP request Description
URIs relative to https://www.googleapis.com/drive/v2, unless otherwise noted
get GET  /about Gets the information about the current user along with Drive API settings

Changes

For Changes Resource details, see the resource representation page.

Method HTTP request Description
URIs relative to https://www.googleapis.com/drive/v2, unless otherwise noted
get GET  /changes/changeId Deprecated - Use changes.getStartPageToken and changes.list to retrieve recent changes.
list GET  /changes Lists the changes for a user or shared drive.
watch POST  /changes/watch Watch for all changes to a user's Drive.
getStartPageToken GET  /changes/startPageToken Gets the starting pageToken for listing future changes.

Children

For Children Resource details, see the resource representation page.

Method HTTP request Description
URIs relative to https://www.googleapis.com/drive/v2, unless otherwise noted
delete DELETE  /files/folderId/children/childId Removes a child from a folder.
get GET  /files/folderId/children/childId Gets a specific child reference.
insert POST  /files/folderId/children Inserts a file into a folder.
list GET  /files/folderId/children Lists a folder's children. To list all children of the root folder, use the alias root for the folderId value.

Parents

For Parents Resource details, see the resource representation page.

Method HTTP request Description
URIs relative to https://www.googleapis.com/drive/v2, unless otherwise noted
delete DELETE  /files/fileId/parents/parentId Removes a parent from a file.
get GET  /files/fileId/parents/parentId Gets a specific parent reference.
insert POST  /files/fileId/parents Adds a parent folder for a file.
list GET  /files/fileId/parents Lists a file's parents.

Permissions

For Permissions Resource details, see the resource representation page.

Method HTTP request Description
URIs relative to https://www.googleapis.com/drive/v2, unless otherwise noted
delete DELETE  /files/fileId/permissions/permissionId Deletes a permission from a file or shared drive.
get GET  /files/fileId/permissions/permissionId Gets a permission by ID.
insert POST  /files/fileId/permissions Inserts a permission for a file or shared drive.
list GET  /files/fileId/permissions Lists a file's or shared drive's permissions.
patch PATCH  /files/fileId/permissions/permissionId Updates a permission using patch semantics.
update PUT  /files/fileId/permissions/permissionId Updates a permission.
getIdForEmail GET  /permissionIds/email Returns the permission ID for an email address.

Revisions

For Revisions Resource details, see the resource representation page.

Method HTTP request Description
URIs relative to https://www.googleapis.com/drive/v2, unless otherwise noted
delete DELETE  /files/fileId/revisions/revisionId Permanently deletes a file version. You can only delete revisions for files with binary content, like images or videos. Revisions for other files, like Google Docs or Sheets, and the last remaining file version can't be deleted.
get GET  /files/fileId/revisions/revisionId Gets a specific revision.
list GET  /files/fileId/revisions Lists a file's revisions.
patch PATCH  /files/fileId/revisions/revisionId Updates a revision. This method supports patch semantics.
update PUT  /files/fileId/revisions/revisionId Updates a revision.

Apps

For Apps Resource details, see the resource representation page.

Method HTTP request Description
URIs relative to https://www.googleapis.com/drive/v2, unless otherwise noted
list GET  /apps Lists a user's installed apps.
get GET  /apps/appId Gets a specific app.

Comments

For Comments Resource details, see the resource representation page.

Method HTTP request Description
URIs relative to https://www.googleapis.com/drive/v2, unless otherwise noted
delete DELETE  /files/fileId/comments/commentId Deletes a comment.
get GET  /files/fileId/comments/commentId Gets a comment by ID.
insert POST  /files/fileId/comments Creates a new comment on the given file.
list GET  /files/fileId/comments Lists a file's comments.
patch PATCH  /files/fileId/comments/commentId Updates an existing comment. This method supports patch semantics.
update PUT  /files/fileId/comments/commentId Updates an existing comment.

Replies

For Replies Resource details, see the resource representation page.

Method HTTP request Description
URIs relative to https://www.googleapis.com/drive/v2, unless otherwise noted
delete DELETE  /files/fileId/comments/commentId/replies/replyId Deletes a reply.
get GET  /files/fileId/comments/commentId/replies/replyId Gets a reply.
insert POST  /files/fileId/comments/commentId/replies Creates a new reply to the given comment.
list GET  /files/fileId/comments/commentId/replies Lists all of the replies to a comment.
patch PATCH  /files/fileId/comments/commentId/replies/replyId Updates an existing reply. This method supports patch semantics.
update PUT  /files/fileId/comments/commentId/replies/replyId Updates an existing reply.

Properties

For Properties Resource details, see the resource representation page.

Method HTTP request Description
URIs relative to https://www.googleapis.com/drive/v2, unless otherwise noted
delete DELETE  /files/fileId/properties/propertyKey Deletes a property.
get GET  /files/fileId/properties/propertyKey Gets a property by its key.
insert POST  /files/fileId/properties Adds a property to a file, or updates it if it already exists.
list GET  /files/fileId/properties Lists a file's properties.
patch PATCH  /files/fileId/properties/propertyKey Updates a property.
update PUT  /files/fileId/properties/propertyKey Updates a property.

Channels

For Channels Resource details, see the resource representation page.

Method HTTP request Description
URIs relative to https://www.googleapis.com/drive/v2, unless otherwise noted
stop POST  /channels/stop Stop watching for changes to a resource.

Realtime

For Realtime Resource details, see the resource representation page.

Method HTTP request Description
URIs relative to https://www.googleapis.com/drive/v2, unless otherwise noted
get GET  /files/fileId/realtime Exports the contents of the Realtime API data model associated with this file as JSON.
update PUT
https://www.googleapis.com/upload/drive/v2/files/fileId/realtime
Overwrites the Realtime API data model associated with this file with the provided JSON data model.

Drives

For Drives Resource details, see the resource representation page.

Method HTTP request Description
URIs relative to https://www.googleapis.com/drive/v2, unless otherwise noted
delete DELETE  /drives/driveId Permanently deletes a shared drive for which the user is an organizer. The shared drive cannot contain any untrashed items.
get GET  /drives/driveId Gets a shared drive's metadata by ID.
hide POST  /drives/driveId/hide Hides a shared drive from the default view.
insert POST  /drives Creates a new shared drive.

Required query parameters: requestId

list GET  /drives Lists the user's shared drives.
unhide POST  /drives/driveId/unhide Restores a shared drive to the default view.
update PUT  /drives/driveId Updates the metadata for a shared drive.

傳送您對下列選項的寶貴意見...

這個網頁
Google Drive API
Google Drive API
需要協助嗎?請前往我們的支援網頁