Google Drive - Update file
@sergio
code:
data:privatelast updated:4 years ago
today
Build integrations remarkably fast!
You're viewing a public workflow template.
Sign up to customize, add steps, modify code and more.
Join 1,000,000+ developers using the Pipedream platform
steps.
trigger
HTTP API
Deploy to generate unique URL
This workflow runs on Pipedream's servers and is triggered by HTTP / Webhook requests.
steps.
googledrive_update_file
Updates a file's metadata and/or content with patch semantics.
auth
(auths.google_drive)
params
FileId

The ID of the file.

 
string ·params.fileId
UploadType

The type of upload request to the /upload URI. Acceptable values are:
media - Simple upload. Upload the media only, without any metadata.
multipart - Multipart upload. Upload both the media and its metadata, in a single request.
resumable - Resumable upload. Upload the file in a resumable fashion, using a series of at least two requests where the first request includes the metadata.

string ·params.uploadType
Optional
code
async (params, auths) => {
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
}
30
//See the API docs here: https://developers.google.com/drive/api/v3/reference/files/update?authuser=2

const config = {
  method: "patch",
  url: `https://www.googleapis.com/upload/drive/v3/files/${params.fileId}`,
  params: {
    uploadType: params.uploadType,
    addParents: params.addParents,
    keepRevisionForever: params.keepRevisionForever,
    ocrLanguage: params.ocrLanguage,
    removeParents: params.removeParents,
    supportsAllDrives: params.supportsAllDrives,
    supportsTeamDrives: params.supportsTeamDrives,
    useContentAsIndexableText: params.useContentAsIndexableText,
    alt: params.alt,
    fields: params.fields,
    key: params.key,
    oauth_token: params.oauth_token,
    prettyPrint: params.prettyPrint,
    quotaUser: params.quotaUser,
    userIp: params.userIp,
  },
  headers: {
    Authorization: `Bearer ${auths.google_drive.oauth_access_token}`,
    "Content-Type": "application/octet-stream",
  },
}
return await require("@pipedreamhq/platform").axios(this, config)