Updates a file's metadata and/or content. When calling this method, only populate fields in the request that you want to modify. When updating fields, some fields might change automatically, such as modifiedDate. This method supports patch semantics.

Scopes

You will need authorization for at least one of the following scopes to make a valid call:

  • https://www.googleapis.com/auth/drive
  • https://www.googleapis.com/auth/drive.appdata
  • https://www.googleapis.com/auth/drive.apps.readonly
  • https://www.googleapis.com/auth/drive.file
  • https://www.googleapis.com/auth/drive.metadata
  • https://www.googleapis.com/auth/drive.scripts

If unset, the scope for this method defaults to https://www.googleapis.com/auth/drive. You can set the scope for this method like this: drive2 --scope <scope> files patch ...

Required Scalar Argument

  • <file-id> (string)
    • The ID of the file to update.

Required Request Value

The request value is a data-structure with various fields. Each field may be a simple scalar or another data-structure. In the latter case it is advised to set the field-cursor to the data-structure's field to specify values more concisely.

For example, a structure like this:

File:
  alternate-link: string
  app-data-contents: boolean
  can-comment: boolean
  can-read-revisions: boolean
  capabilities:
    can-accept-ownership: boolean
    can-add-children: boolean
    can-add-folder-from-another-drive: boolean
    can-add-my-drive-parent: boolean
    can-change-copy-requires-writer-permission: boolean
    can-change-restricted-download: boolean
    can-change-security-update-enabled: boolean
    can-comment: boolean
    can-copy: boolean
    can-delete: boolean
    can-delete-children: boolean
    can-download: boolean
    can-edit: boolean
    can-list-children: boolean
    can-modify-content: boolean
    can-modify-content-restriction: boolean
    can-modify-editor-content-restriction: boolean
    can-modify-labels: boolean
    can-modify-owner-content-restriction: boolean
    can-move-children-out-of-drive: boolean
    can-move-children-out-of-team-drive: boolean
    can-move-children-within-drive: boolean
    can-move-children-within-team-drive: boolean
    can-move-item-into-team-drive: boolean
    can-move-item-out-of-drive: boolean
    can-move-item-out-of-team-drive: boolean
    can-move-item-within-drive: boolean
    can-move-item-within-team-drive: boolean
    can-move-team-drive-item: boolean
    can-read-drive: boolean
    can-read-labels: boolean
    can-read-revisions: boolean
    can-read-team-drive: boolean
    can-remove-children: boolean
    can-remove-content-restriction: boolean
    can-remove-my-drive-parent: boolean
    can-rename: boolean
    can-share: boolean
    can-trash: boolean
    can-trash-children: boolean
    can-untrash: boolean
  copy-requires-writer-permission: boolean
  copyable: boolean
  created-date: string
  default-open-with-link: string
  description: string
  download-url: string
  drive-id: string
  editable: boolean
  embed-link: string
  etag: string
  explicitly-trashed: boolean
  export-links: { string: string }
  file-extension: string
  file-size: string
  folder-color-rgb: string
  full-file-extension: string
  has-augmented-permissions: boolean
  has-thumbnail: boolean
  head-revision-id: string
  icon-link: string
  id: string
  image-media-metadata:
    aperture: number
    camera-make: string
    camera-model: string
    color-space: string
    date: string
    exposure-bias: number
    exposure-mode: string
    exposure-time: number
    flash-used: boolean
    focal-length: number
    height: integer
    iso-speed: integer
    lens: string
    location:
      altitude: number
      latitude: number
      longitude: number
    max-aperture-value: number
    metering-mode: string
    rotation: integer
    sensor: string
    subject-distance: integer
    white-balance: string
    width: integer
  indexable-text:
    text: string
  is-app-authorized: boolean
  kind: string
  labels:
    hidden: boolean
    modified: boolean
    restricted: boolean
    starred: boolean
    trashed: boolean
    viewed: boolean
  last-modifying-user:
    display-name: string
    email-address: string
    is-authenticated-user: boolean
    kind: string
    permission-id: string
    picture:
      url: string
  last-modifying-user-name: string
  last-viewed-by-me-date: string
  link-share-metadata:
    security-update-eligible: boolean
    security-update-enabled: boolean
  marked-viewed-by-me-date: string
  md5-checksum: string
  mime-type: string
  modified-by-me-date: string
  modified-date: string
  open-with-links: { string: string }
  original-filename: string
  owned-by-me: boolean
  owner-names: [string]
  permission-ids: [string]
  quota-bytes-used: string
  resource-key: string
  self-link: string
  sha1-checksum: string
  sha256-checksum: string
  shareable: boolean
  shared: boolean
  shared-with-me-date: string
  sharing-user:
    display-name: string
    email-address: string
    is-authenticated-user: boolean
    kind: string
    permission-id: string
    picture:
      url: string
  shortcut-details:
    target-id: string
    target-mime-type: string
    target-resource-key: string
  spaces: [string]
  team-drive-id: string
  thumbnail:
    image: string
    mime-type: string
  thumbnail-link: string
  thumbnail-version: string
  title: string
  trashed-date: string
  trashing-user:
    display-name: string
    email-address: string
    is-authenticated-user: boolean
    kind: string
    permission-id: string
    picture:
      url: string
  user-permission:
    additional-roles: [string]
    auth-key: string
    deleted: boolean
    domain: string
    email-address: string
    etag: string
    expiration-date: string
    id: string
    kind: string
    name: string
    pending-owner: boolean
    photo-link: string
    role: string
    self-link: string
    type: string
    value: string
    view: string
    with-link: boolean
  version: string
  video-media-metadata:
    duration-millis: string
    height: integer
    width: integer
  web-content-link: string
  web-view-link: string
  writers-can-share: boolean

can be set completely with the following arguments which are assumed to be executed in the given order. Note how the cursor position is adjusted to the respective structures, allowing simple field names to be used most of the time.

  • -r . alternate-link=kasd
    • Output only. A link for opening the file in a relevant Google editor or viewer.
  • app-data-contents=true
    • Output only. Whether this file is in the Application Data folder.
  • can-comment=false
    • Output only. Deprecated: Use capabilities/canComment instead.
  • can-read-revisions=true
    • Output only. Deprecated: Use capabilities/canReadRevisions instead.
  • capabilities can-accept-ownership=false
    • Output only. Whether the current user is the pending owner of the file. Not populated for shared drive files.
  • can-add-children=true
    • Output only. Whether the current user can add children to this folder. This is always false when the item is not a folder.
  • can-add-folder-from-another-drive=true
    • Output only. Whether the current user can add a folder from another drive (different shared drive or My Drive) to this folder. This is false when the item is not a folder. Only populated for items in shared drives.
  • can-add-my-drive-parent=true
    • Output only. Whether the current user can add a parent for the item without removing an existing parent in the same request. Not populated for shared drive files.
  • can-change-copy-requires-writer-permission=true
    • Output only. Whether the current user can change the copyRequiresWriterPermission restriction of this file.
  • can-change-restricted-download=true
    • Output only. Deprecated.
  • can-change-security-update-enabled=true
    • Output only. Whether the current user can change the securityUpdateEnabled field on link share metadata.
  • can-comment=false
    • Output only. Whether the current user can comment on this file.
  • can-copy=false
    • Output only. Whether the current user can copy this file. For an item in a shared drive, whether the current user can copy non-folder descendants of this item, or this item itself if it is not a folder.
  • can-delete=true
    • Output only. Whether the current user can delete this file.
  • can-delete-children=false
    • Output only. Whether the current user can delete children of this folder. This is false when the item is not a folder. Only populated for items in shared drives.
  • can-download=true
    • Output only. Whether the current user can download this file.
  • can-edit=true
    • Output only. Whether the current user can edit this file. Other factors may limit the type of changes a user can make to a file. For example, see canChangeCopyRequiresWriterPermission or canModifyContent.
  • can-list-children=true
    • Output only. Whether the current user can list the children of this folder. This is always false when the item is not a folder.
  • can-modify-content=false
    • Output only. Whether the current user can modify the content of this file.
  • can-modify-content-restriction=true
    • Deprecated: Output only. Use one of canModifyEditorContentRestriction, canModifyOwnerContentRestriction or canRemoveContentRestriction.
  • can-modify-editor-content-restriction=false
    • Output only. Whether the current user can add or modify content restrictions on the file which are editor restricted.
  • can-modify-labels=false
    • Output only. Whether the current user can modify the labels on the file.
  • can-modify-owner-content-restriction=false
    • Output only. Whether the current user can add or modify content restrictions which are owner restricted.
  • can-move-children-out-of-drive=false
    • Output only. Whether the current user can move children of this folder outside of the shared drive. This is false when the item is not a folder. Only populated for items in shared drives.
  • can-move-children-out-of-team-drive=true
    • Output only. Deprecated: Use canMoveChildrenOutOfDrive instead.
  • can-move-children-within-drive=true
    • Output only. Whether the current user can move children of this folder within this drive. This is false when the item is not a folder. Note that a request to move the child may still fail depending on the current user's access to the child and to the destination folder.
  • can-move-children-within-team-drive=true
    • Output only. Deprecated: Use canMoveChildrenWithinDrive instead.
  • can-move-item-into-team-drive=true
    • Output only. Deprecated: Use canMoveItemOutOfDrive instead.
  • can-move-item-out-of-drive=true
    • Output only. Whether the current user can move this item outside of this drive by changing its parent. Note that a request to change the parent of the item may still fail depending on the new parent that is being added.
  • can-move-item-out-of-team-drive=false
    • Output only. Deprecated: Use canMoveItemOutOfDrive instead.
  • can-move-item-within-drive=false
    • Output only. Whether the current user can move this item within this drive. Note that a request to change the parent of the item may still fail depending on the new parent that is being added and the parent that is being removed.
  • can-move-item-within-team-drive=false
    • Output only. Deprecated: Use canMoveItemWithinDrive instead.
  • can-move-team-drive-item=true
    • Output only. Deprecated: Use canMoveItemWithinDrive or canMoveItemOutOfDrive instead.
  • can-read-drive=true
    • Output only. Whether the current user can read the shared drive to which this file belongs. Only populated for items in shared drives.
  • can-read-labels=true
    • Output only. Whether the current user can read the labels on the file.
  • can-read-revisions=false
    • Output only. Whether the current user can read the revisions resource of this file. For a shared drive item, whether revisions of non-folder descendants of this item, or this item itself if it is not a folder, can be read.
  • can-read-team-drive=true
    • Output only. Deprecated: Use canReadDrive instead.
  • can-remove-children=false
    • Output only. Whether the current user can remove children from this folder. This is always false when the item is not a folder. For a folder in a shared drive, use canDeleteChildren or canTrashChildren instead.
  • can-remove-content-restriction=true
    • Output only. Whether there is a content restriction on the file that can be removed by the current user.
  • can-remove-my-drive-parent=true
    • Output only. Whether the current user can remove a parent from the item without adding another parent in the same request. Not populated for shared drive files.
  • can-rename=false
    • Output only. Whether the current user can rename this file.
  • can-share=true
    • Output only. Whether the current user can modify the sharing settings for this file.
  • can-trash=false
    • Output only. Whether the current user can move this file to trash.
  • can-trash-children=false
    • Output only. Whether the current user can trash children of this folder. This is false when the item is not a folder. Only populated for items in shared drives.
  • can-untrash=false

    • Output only. Whether the current user can restore this file from trash.
  • .. copy-requires-writer-permission=true

    • Whether the options to copy, print, or download this file, should be disabled for readers and commenters.
  • copyable=true
    • Output only. Deprecated: Use capabilities/canCopy instead.
  • created-date=stet
    • Create time for this file (formatted RFC 3339 timestamp).
  • default-open-with-link=sadipscing
    • Output only. A link to open this file with the user's default app for this file. Only populated when the drive.apps.readonly scope is used.
  • description=voluptua.
    • A short description of the file.
  • download-url=et
    • Output only. Short lived download URL for the file. This field is only populated for files with content stored in Google Drive; it is not populated for Google Docs or shortcut files.
  • drive-id=clita
    • Output only. ID of the shared drive the file resides in. Only populated for items in shared drives.
  • editable=false
    • Output only. Deprecated: Use capabilities/canEdit instead.
  • embed-link=rebum.
    • Output only. A link for embedding the file.
  • etag=sanctus
    • Output only. ETag of the file.
  • explicitly-trashed=true
    • Output only. Whether this file has been explicitly trashed, as opposed to recursively trashed.
  • export-links=key=stet
    • Output only. Links for exporting Docs Editors files to specific formats.
    • the value will be associated with the given key
  • file-extension=diam
    • Output only. The final component of fullFileExtension with trailing text that does not appear to be part of the extension removed. This field is only populated for files with content stored in Google Drive; it is not populated for Docs Editors or shortcut files.
  • file-size=ipsum
    • Output only. Size in bytes of blobs and first party editor files. Won't be populated for files that have no size, like shortcuts and folders.
  • folder-color-rgb=eos
    • Folder color as an RGB hex string if the file is a folder or a shortcut to a folder. The list of supported colors is available in the folderColorPalette field of the About resource. If an unsupported color is specified, it will be changed to the closest color in the palette.
  • full-file-extension=erat
    • Output only. The full file extension; extracted from the title. May contain multiple concatenated extensions, such as "tar.gz". Removing an extension from the title does not clear this field; however, changing the extension on the title does update this field. This field is only populated for files with content stored in Google Drive; it is not populated for Docs Editors or shortcut files.
  • has-augmented-permissions=false
    • Output only. Whether there are permissions directly on this file. This field is only populated for items in shared drives.
  • has-thumbnail=false
    • Output only. Whether this file has a thumbnail. This does not indicate whether the requesting app has access to the thumbnail. To check access, look for the presence of the thumbnailLink field.
  • head-revision-id=justo
    • Output only. The ID of the file's head revision. This field is only populated for files with content stored in Google Drive; it is not populated for Docs Editors or shortcut files.
  • icon-link=eirmod
    • Output only. A link to the file's icon.
  • id=duo
    • The ID of the file.
  • image-media-metadata aperture=0.7313189546974894
    • Output only. The aperture used to create the photo (f-number).
  • camera-make=voluptua.
    • Output only. The make of the camera used to create the photo.
  • camera-model=eirmod
    • Output only. The model of the camera used to create the photo.
  • color-space=sanctus
    • Output only. The color space of the photo.
  • date=rebum.
    • Output only. The date and time the photo was taken (EXIF format timestamp).
  • exposure-bias=0.2974875388730174
    • Output only. The exposure bias of the photo (APEX value).
  • exposure-mode=erat
    • Output only. The exposure mode used to create the photo.
  • exposure-time=0.8853431528130798
    • Output only. The length of the exposure, in seconds.
  • flash-used=true
    • Output only. Whether a flash was used to create the photo.
  • focal-length=0.8460726245958297
    • Output only. The focal length used to create the photo, in millimeters.
  • height=69
    • Output only. The height of the image in pixels.
  • iso-speed=59
    • Output only. The ISO speed used to create the photo.
  • lens=vero
    • Output only. The lens used to create the photo.
  • location altitude=0.9995102253000223
    • Output only. The altitude stored in the image.
  • latitude=0.5272183076791913
    • Output only. The latitude stored in the image.
  • longitude=0.43478992604829414

    • Output only. The longitude stored in the image.
  • .. max-aperture-value=0.14528423055981043

    • Output only. The smallest f-number of the lens at the focal length used to create the photo (APEX value).
  • metering-mode=clita
    • Output only. The metering mode used to create the photo.
  • rotation=13
    • Output only. The number of clockwise 90 degree rotations applied from the image's original orientation.
  • sensor=accusam
    • Output only. The type of sensor used to create the photo.
  • subject-distance=49
    • Output only. The distance to the subject of the photo, in meters.
  • white-balance=sanctus
    • Output only. The white balance mode used to create the photo.
  • width=13

    • Output only. The width of the image in pixels.
  • ..indexable-text text=sit

    • The text to be indexed for this file.
  • .. is-app-authorized=false

    • Output only. Whether the file was created or opened by the requesting app.
  • kind=et
    • Output only. The type of file. This is always drive#file.
  • labels hidden=true
    • Output only. Deprecated.
  • modified=true
    • Output only. Whether the file has been modified by this user.
  • restricted=false
    • Output only. Deprecated: Use copyRequiresWriterPermission instead.
  • starred=true
    • Whether this file is starred by the user.
  • trashed=false
    • Whether this file has been trashed. This label applies to all users accessing the file; however, only owners are allowed to see and untrash files.
  • viewed=true

    • Whether this file has been viewed by this user.
  • ..last-modifying-user display-name=invidunt

    • Output only. A plain text displayable name for this user.
  • email-address=invidunt
    • Output only. The email address of the user.
  • is-authenticated-user=true
    • Output only. Whether this user is the same as the authenticated user for whom the request was made.
  • kind=sed
    • Output only. This is always drive#user.
  • permission-id=justo
    • Output only. The user's ID as visible in the permissions collection.
  • picture url=amet

    • Output Only. A URL that points to a profile picture of this user.
  • ... last-modifying-user-name=sed

    • Output only. Name of the last user to modify this file.
  • last-viewed-by-me-date=ut
    • Last time this file was viewed by the user (formatted RFC 3339 timestamp).
  • link-share-metadata security-update-eligible=false
    • Output only. Whether the file is eligible for security update.
  • security-update-enabled=false

    • Output only. Whether the security update is enabled for this file.
  • .. marked-viewed-by-me-date=at

    • Deprecated.
  • md5-checksum=ut
    • Output only. An MD5 checksum for the content of this file. This field is only populated for files with content stored in Google Drive; it is not populated for Docs Editors or shortcut files.
  • mime-type=consetetur
    • 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.
  • modified-by-me-date=at
    • 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.
  • modified-date=et
    • Last time this file was modified by anyone (formatted RFC 3339 timestamp). This is only mutable on update when the setModifiedDate parameter is set.
  • open-with-links=key=dolor
    • Output only. A map of the id of each of the user's apps to a link to open this file with that app. Only populated when the drive.apps.readonly scope is used.
    • the value will be associated with the given key
  • original-filename=clita
    • The original filename of the uploaded content if available, or else the original value of the title field. This is only available for files with binary content in Google Drive.
  • owned-by-me=false
    • Output only. Whether the file is owned by the current user. Not populated for items in shared drives.
  • owner-names=amet
    • Output only. Name(s) of the owner(s) of this file. Not populated for items in shared drives.
    • Each invocation of this argument appends the given value to the array.
  • permission-ids=dolor
    • Output only. List of permission IDs for users with access to this file.
    • Each invocation of this argument appends the given value to the array.
  • quota-bytes-used=dolore
    • Output only. The number of quota bytes used by this file.
  • resource-key=clita
    • Output only. A key needed to access the item via a shared link.
  • self-link=et
    • Output only. A link back to this file.
  • sha1-checksum=diam
    • Output only. The SHA1 checksum associated with this file, if available. This field is only populated for files with content stored in Google Drive; it is not populated for Docs Editors or shortcut files.
  • sha256-checksum=sanctus
    • Output only. The SHA256 checksum associated with this file, if available. This field is only populated for files with content stored in Google Drive; it is not populated for Docs Editors or shortcut files.
  • shareable=false
    • Output only. Deprecated: Use capabilities/canShare instead.
  • shared=true
    • Output only. Whether the file has been shared. Not populated for items in shared drives.
  • shared-with-me-date=sed
    • Time at which this file was shared with the user (formatted RFC 3339 timestamp).
  • sharing-user display-name=tempor
    • Output only. A plain text displayable name for this user.
  • email-address=et
    • Output only. The email address of the user.
  • is-authenticated-user=false
    • Output only. Whether this user is the same as the authenticated user for whom the request was made.
  • kind=vero
    • Output only. This is always drive#user.
  • permission-id=sed
    • Output only. The user's ID as visible in the permissions collection.
  • picture url=et

    • Output Only. A URL that points to a profile picture of this user.
  • ...shortcut-details target-id=sea

    • The ID of the file that this shortcut points to.
  • target-mime-type=ut
    • Output only. The MIME type of the file that this shortcut points to. The value of this field is a snapshot of the target's MIME type, captured when the shortcut is created.
  • target-resource-key=et

    • Output only. The ResourceKey for the target file.
  • .. spaces=sanctus

    • Output only. The list of spaces which contain the file. Supported values are drive, appDataFolder and photos.
    • Each invocation of this argument appends the given value to the array.
  • team-drive-id=magna
    • Output only. Deprecated: Use driveId instead.
  • thumbnail image=magna
    • The URL-safe Base64 encoded bytes of the thumbnail image. It should conform to RFC 4648 section 5.
  • mime-type=ea

    • The MIME type of the thumbnail.
  • .. thumbnail-link=no

    • Output only. A short-lived link to the file's thumbnail, if available. Typically lasts on the order of hours. Only populated when the requesting app can access the file's content. If the file isn't shared publicly, the URL returned in Files.thumbnailLink must be fetched using a credentialed request.
  • thumbnail-version=aliquyam
    • Output only. The thumbnail version for use in thumbnail cache invalidation.
  • title=sed
    • The title of this file. Note that for immutable items such as the top level folders of shared drives, My Drive root folder, and Application Data folder the title is constant.
  • trashed-date=dolores
    • The time that the item was trashed (formatted RFC 3339 timestamp). Only populated for items in shared drives.
  • trashing-user display-name=invidunt
    • Output only. A plain text displayable name for this user.
  • email-address=sadipscing
    • Output only. The email address of the user.
  • is-authenticated-user=true
    • Output only. Whether this user is the same as the authenticated user for whom the request was made.
  • kind=ut
    • Output only. This is always drive#user.
  • permission-id=consetetur
    • Output only. The user's ID as visible in the permissions collection.
  • picture url=amet

    • Output Only. A URL that points to a profile picture of this user.
  • ...user-permission additional-roles=vero

    • Additional roles for this user. Only commenter is currently allowed, though more may be supported in the future.
    • Each invocation of this argument appends the given value to the array.
  • auth-key=ipsum
    • Output only. Deprecated.
  • deleted=true
    • Output only. Whether the account associated with this permission has been deleted. This field only pertains to user and group permissions.
  • domain=est
    • Output only. The domain name of the entity this permission refers to. This is an output-only field which is present when the permission type is user, group or domain.
  • email-address=rebum.
    • Output only. The email address of the user or group this permission refers to. This is an output-only field which is present when the permission type is user or group.
  • etag=nonumy
    • Output only. The ETag of the permission.
  • expiration-date=rebum.
    • The time at which this permission will expire (RFC 3339 date-time). Expiration dates have the following restrictions: - They can only be set on user and group permissions - The date must be in the future - The date cannot be more than a year in the future - The date can only be set on drive.permissions.update or drive.permissions.patch requests
  • id=et
    • The ID of the user this permission refers to, and identical to the permissionId in the About and Files resources. When making a drive.permissions.insert request, exactly one of the id or value fields must be specified unless the permission type is anyone, in which case both id and value are ignored.
  • kind=et
    • Output only. This is always drive#permission.
  • name=aliquyam
    • Output only. The name for this permission.
  • pending-owner=false
    • Whether the account associated with this permission is a pending owner. Only populated for user type permissions for files that are not in a shared drive.
  • photo-link=tempor
    • Output only. A link to the profile photo, if available.
  • role=dolore
    • The primary role for this user. While new values may be supported in the future, the following are currently allowed: * owner * organizer * fileOrganizer * writer * reader
  • self-link=dolore
    • Output only. A link back to this permission.
  • type=ipsum
    • The account type. Allowed values are: * user * group * domain * anyone
  • value=takimata
    • The email address or domain name for the entity. This is used during inserts and is not populated in responses. When making a drive.permissions.insert request, exactly one of the id or value fields must be specified unless the permission type is anyone, in which case both id and value are ignored.
  • view=justo
    • Indicates the view for this permission. Only populated for permissions that belong to a view. published is the only supported value.
  • with-link=true

    • Whether the link is required for this permission.
  • .. version=ipsum

    • Output only. A monotonically increasing version number for the file. This reflects every change made to the file on the server, even those not visible to the requesting user.
  • video-media-metadata duration-millis=diam
    • Output only. The duration of the video in milliseconds.
  • height=21
    • Output only. The height of the video in pixels.
  • width=80

    • Output only. The width of the video in pixels.
  • .. web-content-link=ea

    • Output only. A link for downloading the content of the file in a browser using cookie based authentication. In cases where the content is shared publicly, the content can be downloaded without any credentials.
  • web-view-link=et
    • Output only. A link only available on public folders for viewing their static web assets (HTML, CSS, JS, etc) via Google Drive's Website Hosting.
  • writers-can-share=true
    • Whether writers can share the document with other users. Not populated for items in shared drives.

About Cursors

The cursor position is key to comfortably set complex nested structures. The following rules apply:

  • The cursor position is always set relative to the current one, unless the field name starts with the . character. Fields can be nested such as in -r f.s.o .
  • The cursor position is set relative to the top-level structure if it starts with ., e.g. -r .s.s
  • You can also set nested fields without setting the cursor explicitly. For example, to set a value relative to the current cursor position, you would specify -r struct.sub_struct=bar.
  • You can move the cursor one level up by using ... Each additional . moves it up one additional level. E.g. ... would go three levels up.

Optional Output Flags

The method's return value a JSON encoded structure, which will be written to standard output by default.

  • -o out
    • out specifies the destination to which to write the server's result to. It will be a JSON-encoded structure. The destination may be - to indicate standard output, or a filepath that is to contain the received bytes. If unset, it defaults to standard output.

Optional Method Properties

You may set the following properties to further configure the call. Please note that -p is followed by one or more key-value-pairs, and is called like this -p k1=v1 k2=v2 even though the listing below repeats the -p for completeness.

  • -p add-parents=string

    • Comma-separated list of parent IDs to add.
  • -p convert=boolean

    • Deprecated: This parameter has no function.
  • -p enforce-single-parent=boolean

    • Deprecated: Adding files to multiple folders is no longer supported. Use shortcuts instead.
  • -p include-labels=string

    • A comma-separated list of IDs of labels to include in the labelInfo part of the response.
  • -p include-permissions-for-view=string

    • Specifies which additional view's permissions to include in the response. Only published is supported.
  • -p modified-date-behavior=string

    • Determines the behavior in which modifiedDate is updated. This overrides setModifiedDate.
  • -p new-revision=boolean

    • Whether a blob upload should create a new revision. If false, the blob data in the current head revision is replaced. If true or not set, a new blob is created as head revision, and previous unpinned revisions are preserved for a short period of time. Pinned revisions are stored indefinitely, using additional storage quota, up to a maximum of 200 revisions. For details on how revisions are retained, see the Drive Help Center. Note that this field is ignored if there is no payload in the request.
  • -p ocr=boolean

    • Whether to attempt OCR on .jpg, .png, .gif, or .pdf uploads.
  • -p ocr-language=string

    • If ocr is true, hints at the language to use. Valid values are BCP 47 codes.
  • -p pinned=boolean

    • Whether to pin the new revision. A file can have a maximum of 200 pinned revisions. Note that this field is ignored if there is no payload in the request.
  • -p remove-parents=string

    • Comma-separated list of parent IDs to remove.
  • -p set-modified-date=boolean

    • Whether to set the modified date using the value supplied in the request body. Setting this field to true is equivalent to modifiedDateBehavior=fromBodyOrNow, and false is equivalent to modifiedDateBehavior=now. To prevent any changes to the modified date set modifiedDateBehavior=noChange.
  • -p supports-all-drives=boolean

    • Whether the requesting application supports both My Drives and shared drives.
  • -p supports-team-drives=boolean

    • Deprecated: Use supportsAllDrives instead.
  • -p timed-text-language=string

    • The language of the timed text.
  • -p timed-text-track-name=string

    • The timed text track name.
  • -p update-viewed-date=boolean

    • Whether to update the view date after successfully updating the file.
  • -p use-content-as-indexable-text=boolean

    • Whether to use the content as indexable text.

Optional General Properties

The following properties can configure any call, and are not specific to this method.

  • -p $-xgafv=string

    • V1 error format.
  • -p access-token=string

    • OAuth access token.
  • -p alt=string

    • Data format for response.
  • -p callback=string

    • JSONP
  • -p fields=string

    • Selector specifying which fields to include in a partial response.
  • -p key=string

    • API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
  • -p oauth-token=string

    • OAuth 2.0 token for the current user.
  • -p pretty-print=boolean

    • Returns response with indentations and line breaks.
  • -p quota-user=string

    • Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
  • -p upload-type=string

    • Legacy upload protocol for media (e.g. "media", "multipart").
  • -p upload-protocol=string

    • Upload protocol for media (e.g. "raw", "multipart").