Renames a folder within a bucket with hierarchical namespace enabled. For details about how the rename operation works, see Rename folders.
Required permissions
The authenticated user must have the following IAM permissions to use this method:
storage.folders.rename
- This permission is needed to rename the source folder.
storage.folders.create
- This permission is needed to create the destination folder.
Request
HTTP request
POST https://storage.googleapis.com/storage/v1/b/bucket/folders/sourcePath/renameTo/folders/destinationPath
In addition to standard query parameters, the following parameters apply to this method.
To see an example of how to include query parameters in a request, see the JSON API Overview page.
Parameters
Parameter name | Value | Description |
---|---|---|
Path parameters | ||
bucket |
string |
The parent bucket of the folder. |
sourcePath |
string |
The URL-encoded name of the source folder, expressed as a path. For example, src-folder/ ,
URL-encoded as src-folder%2F .
|
destinationPath |
string |
The URL-encoded name of the destination folder, expressed as a path. For example, dest-folder/ ,
URL-encoded as dest-folder%2F .
|
Optional query parameters | ||
ifMetagenerationMatch |
long |
If set, only rename the folder if the source folder's metageneration matches this value. |
ifMetagenerationNotMatch |
long |
If set, only rename the folder if the source folder's metageneration doesn't match this value. |
Request body
Do not supply a request body with this method.
Response
If successful, this method returns a long-running operation to support recursively renaming a folder and everything under that folder.
For information about status and error codes returned by this API, see the reference page.
Try it!
Use the APIs Explorer below to call this method on live data and see the response.