Reputation: 177
Is there a way to rename a Google Drive folder via the REST API?
The folders I want to do this with typically have subfolders and files inside them.
I've found documentation for renaming files, but nothing about folders.
Upvotes: 4
Views: 4457
Reputation: 38
Folders are treated as files in the v3 API, therefore the endpoint you mentioned will work for folders, as well as for files.
If you want to do this via the REST API, you can do so by making a PATCH HTTP request to https://www.googleapis.com/drive/v3/files/[fileOrFolderId]
The request body should include:
{
"name": "newFolderName"
}
Upvotes: 2
Reputation: 336
Use Drive API files.update. Your request body should look something like:
{
"name": "newFileName"
}
Upvotes: 3