Google Drive SDK

Files

For a list of methods for this resource, see the end of this page.

Resource representations

The metadata for a file.

{
  "kind": "drive#file",
  "id": string,
  "etag": etag,
  "selfLink": string,
  "webContentLink": string,
  "webViewLink": string,
  "alternateLink": string,
  "embedLink": string,
  "openWithLinks": {
    (key): string
  },
  "defaultOpenWithLink": string,
  "iconLink": string,
  "thumbnailLink": string,
  "thumbnail": {
    "image": bytes,
    "mimeType": string
  },
  "title": string,
  "mimeType": string,
  "description": string,
  "labels": {
    "starred": boolean,
    "hidden": boolean,
    "trashed": boolean,
    "restricted": boolean,
    "viewed": boolean
  },
  "createdDate": datetime,
  "modifiedDate": datetime,
  "modifiedByMeDate": datetime,
  "lastViewedByMeDate": datetime,
  "sharedWithMeDate": datetime,
  "parents": [
    parents Resource
  ],
  "downloadUrl": string,
  "exportLinks": {
    (key): string
  },
  "indexableText": {
    "text": string
  },
  "userPermission": permissions Resource,
  "originalFilename": string,
  "fileExtension": string,
  "md5Checksum": string,
  "fileSize": long,
  "quotaBytesUsed": long,
  "ownerNames": [
    string
  ],
  "owners": [
    {
      "kind": "drive#user",
      "displayName": string,
      "picture": {
        "url": string
      },
      "isAuthenticatedUser": boolean,
      "permissionId": string
    }
  ],
  "lastModifyingUserName": string,
  "lastModifyingUser": {
    "kind": "drive#user",
    "displayName": string,
    "picture": {
      "url": string
    },
    "isAuthenticatedUser": boolean,
    "permissionId": string
  },
  "editable": boolean,
  "copyable": boolean,
  "writersCanShare": boolean,
  "shared": boolean,
  "explicitlyTrashed": boolean,
  "appDataContents": boolean,
  "headRevisionId": string,
  "properties": [
    properties Resource
  ],
  "imageMediaMetadata": {
    "width": integer,
    "height": integer,
    "rotation": integer,
    "location": {
      "latitude": double,
      "longitude": double,
      "altitude": double
    },
    "date": string,
    "cameraMake": string,
    "cameraModel": string,
    "exposureTime": float,
    "aperture": float,
    "flashUsed": boolean,
    "focalLength": float,
    "isoSpeed": integer,
    "meteringMode": string,
    "sensor": string,
    "exposureMode": string,
    "colorSpace": string,
    "whiteBalance": string,
    "exposureBias": float,
    "maxApertureValue": float,
    "subjectDistance": integer,
    "lens": string
  }
}
Property name Value Description Notes
appDataContents boolean Whether this file is in the appdata folder.
copyable boolean Whether the file can be copied by the current user.
createdDate datetime Create time for this file (formatted ISO8601 timestamp).
description string A short description of the file. writable
downloadUrl string Short lived download URL for the file. This is only populated for files with content stored in Drive.
editable boolean Whether the file can be edited by the current user.
etag etag ETag of the file.
explicitlyTrashed boolean Whether this file has been explicitly trashed, as opposed to recursively trashed. This will only be populated if the file is trashed.
exportLinks.(key) string A mapping from export format to URL
fileExtension string The file extension used when downloading this file. This field is read only. To set the extension, include it in the title when creating the file. This is only populated for files with content stored in Drive.
fileSize long The size of the file in bytes. This is only populated for files with content stored in Drive.
headRevisionId string The ID of the file's head revision. This will only be populated for files with content stored in Drive.
id string The ID of the file.
imageMediaMetadata object Metadata about image media. This will only be present for image types, and its contents will depend on what can be parsed from the image content.
imageMediaMetadata.aperture float The aperture used to create the photo (f-number).
imageMediaMetadata.cameraMake string The make of the camera used to create the photo.
imageMediaMetadata.cameraModel string The model of the camera used to create the photo.
imageMediaMetadata.colorSpace string The color space of the photo.
imageMediaMetadata.date string The date and time the photo was taken (EXIF format timestamp).
imageMediaMetadata.exposureBias float The exposure bias of the photo (APEX value).
imageMediaMetadata.exposureMode string The exposure mode used to create the photo.
imageMediaMetadata.exposureTime float The length of the exposure, in seconds.
imageMediaMetadata.flashUsed boolean Whether a flash was used to create the photo.
imageMediaMetadata.focalLength float The focal length used to create the photo, in millimeters.
imageMediaMetadata.height integer The height of the image in pixels.
imageMediaMetadata.isoSpeed integer The ISO speed used to create the photo.
imageMediaMetadata.lens string The lens used to create the photo.
imageMediaMetadata.location object Geographic location information stored in the image.
imageMediaMetadata.location.altitude double The altitude stored in the image.
imageMediaMetadata.location.latitude double The latitude stored in the image.
imageMediaMetadata.location.longitude double The longitude stored in the image.
imageMediaMetadata.maxApertureValue float The smallest f-number of the lens at the focal length used to create the photo (APEX value).
imageMediaMetadata.meteringMode string The metering mode used to create the photo.
imageMediaMetadata.rotation integer The rotation in clockwise degrees from the image's original orientation.
imageMediaMetadata.sensor string The type of sensor used to create the photo.
imageMediaMetadata.subjectDistance integer The distance to the subject of the photo, in meters.
imageMediaMetadata.whiteBalance string The white balance mode used to create the photo.
imageMediaMetadata.width integer The width of the image in pixels.
indexableText object Indexable text attributes for the file. This property can only be written, and is not returned by files.get. For more information, see Saving indexable text.
indexableText.text string The text to be indexed for this file. writable
kind string The type of file. This is always drive#file.
labels object A group of labels for the file.
labels.hidden boolean Deprecated. writable
labels.restricted boolean Whether viewers are prevented from downloading this file. writable
labels.starred boolean Whether this file is starred by the user. writable
labels.trashed boolean Whether this file has been trashed. writable
labels.viewed boolean Whether this file has been viewed by this user. writable
lastModifyingUser nested object The last user to modify this file.
lastModifyingUser.displayName string A plain text displayable name for this user.
lastModifyingUser.isAuthenticatedUser boolean Whether this user is the same as the authenticated user for whom the request was made.
lastModifyingUser.kind string This is always drive#user.
lastModifyingUser.permissionId string The user's ID as visible in the permissions collection.
lastModifyingUser.picture object The user's profile picture.
lastModifyingUser.picture.url string A URL that points to a profile picture of this user.
lastModifyingUserName string Name of the last user to modify this file.
lastViewedByMeDate datetime Last time this file was viewed by the user (formatted RFC 3339 timestamp). writable
md5Checksum string An MD5 checksum for the content of this file. This is populated only for files with content stored in Drive.
mimeType string The MIME type of the file. This is only mutable on update when uploading new content. This field can be left blank, and the mimetype will be determined from the uploaded content's MIME type. writable
modifiedByMeDate datetime Last time this file was modified by the user (formatted RFC 3339 timestamp). Note that setting modifiedDate will also update the modifiedByMe date for the user which set the date.
modifiedDate datetime Last time this file was modified by anyone (formatted RFC 3339 timestamp). This is only mutable on update when the setModifiedDate parameter is set. writable
openWithLinks.(key) string
originalFilename string The original filename if the file was uploaded manually, or the original title if the file was inserted through the API. Note that renames of the title will not change the original filename. This will only be populated on files with content stored in Drive.
ownerNames[] list Name(s) of the owner(s) of this file.
owners[] list The owner(s) of this file.
owners[].displayName string A plain text displayable name for this user.
owners[].isAuthenticatedUser boolean Whether this user is the same as the authenticated user for whom the request was made.
owners[].kind string This is always drive#user.
owners[].permissionId string The user's ID as visible in the permissions collection.
owners[].picture object The user's profile picture.
owners[].picture.url string A URL that points to a profile picture of this user.
parents[] list Collection of parent folders which contain this file.

Setting this field will put the file in all of the provided folders. On insert, if no folders are provided, the file will be placed in the default root folder.

writable
properties[] list The list of properties. This is a write-only field. writable
quotaBytesUsed long The number of quota bytes used by this file.
shared boolean Whether the file has been shared.
sharedWithMeDate datetime Time at which this file was shared with the user (formatted RFC 3339 timestamp).
thumbnail object Thumbnail for the file. Only accepted on upload and for files that are not already thumbnailed by Google.
thumbnail.image bytes The URL-safe Base64 encoded bytes of the thumbnail image.
thumbnail.mimeType string The MIME type of the thumbnail.
title string The title of the this file. Used to identify file or folder name. writable
userPermission nested object The permissions for the authenticated user on this file.
writersCanShare boolean Whether writers can share the document with other users. writable

Methods

copy
Creates a copy of the specified file.
delete
Permanently deletes a file by ID. Skips the trash.
get
Gets a file's metadata by ID.
insert
Insert a new file.
list
Lists the user's files.
patch
Updates file metadata. This method supports patch semantics.
touch
Set the file's updated time to the current server time.
trash
Moves a file to the trash.
untrash
Restores a file from the trash.
update
Updates file metadata and/or content.
watch
Start watching for changes to a file.

Authentication required

You need to be signed in with Google+ to do that.

Signing you in...

Google Developers needs your permission to do that.