Torch Object Storage
Call the RenameObject interface to rename an object.
For flat buckets (FNS): the RenameObject feature must be enabled. For detailed steps, see Use RenameObject or PutBucketRename.
For hierarchical buckets (HNS): RenameObject is supported by default and does not require additional enablement.
| Category | Precautions |
|---|---|
| Permissions | Before executing the RenameObject operation, ensure the account you use has RenameObject and PutObject permissions. |
| Constraints and limitations | The RenameObject feature is mutually exclusive with the version control feature. If version control is enabled or paused on your bucket, the RenameObject feature cannot be used. (Version control is not yet supported for hierarchical buckets, so this constraint does not apply.) |
| Renamed content | The RenameObject interface modifies the object’s name and updates the object's modification time. |
The renamed object |
|
PUT /objectName?name=Name&rename HTTP/1.1 Host: bucketname.tos-cn-beijing.volces.com Date: GMT Date Authorization: authorization string
This request uses common request headers. See Common parameters.
| Name | Location | Type | Required | Sample Value | Description |
|---|---|---|---|---|---|
| rename | Query | String | Yes | - | Setting the parameter name alone suffices; no need to set the parameter value. This indicates a special identifier for the RenameObject request. |
| name | Query | String | Yes | dst-object | The name after renaming the object. |
x-tos-forbid-overwrite | Header | String | No | false | Whether to allow overwriting objects with the same name, the values are explained as follows:
The default is false, which means overwriting objects with the same name is allowed by default. |
x-tos-recursive-mkdir | Header | String | No | true | This parameter applies only to hierarchical buckets, with the following values:
Default is false. |
There is no request element in this request message.
This request returns the common response message headers, please see Common parameters.
There is no message element in this request response.
PUT /src-object?name=dst-object&rename HTTP/1.1 Host: bucketname.tos-cn-beijing.volces.com Date: GMT Date Authorization: authorization string
HTTP/1.1 204 No Content x-tos-id-2: 367be10900210004-a444ed0 x-tos-request-id: 367be10900210004-a444ed0 Date: Fri, 1 Jul 2022 01:00:36 GMT Server: TosServer