tencent cloud

Cloud Object Storage

Move Object

Download
Mode fokus
Ukuran font
Terakhir diperbarui: 2026-08-25 15:40:32
Diterjemahkan oleh AI

Overview

Move an object (file or directory) to a new location within the same media library.
Attention:
Errors may be returned when a COS Agent Bucket receives a move request or is moving an object. If an error occurs before the move operation starts, you will receive a standard error response. If an error occurs during the move operation, the interface still returns HTTP 200 OK, with the error included in the response body. This means an HTTP 200 OK response can indicate either success or failure. When using this API, you should further determine the success or failure of the move request based on the response body content and handle the result accordingly.

Request

Request Syntax

PUT /<ObjectKey> HTTP/1.1
Host: <BucketName-APPID>.cos.<Region>.myqcloud.com
x-cos-move-source: <BucketName-APPID>.cos.<Region>.myqcloud.com/<SourceObjectKey>
Authorization: Auth String

Note:
Host: <BucketName-APPID>.cos.<Region>.myqcloud.com. Here, <BucketName-APPID> is the bucket name with the APPID suffix, for example, smhxxxxxxxxxxxxx-1250000000. <Region> is the available region. For details, see Product Overview.
SourceObjectKey: The path to the object to be moved.
Authorization: Auth String (For details, see Request Signature).

Request Parameters

Term
Description
Type
Required
conflict_resolution_strategy
The conflict resolution policy when the target already exists. Valid values: ask, rename, overwrite
In case of a conflict, the system returns HTTP 409 Conflict and the SameNameDirectoryOrFileExists error code.
rename: Automatically renames the last-level directory in case of a conflict.
overwrite: If the conflicting target is a directory, the system returns HTTP 409 Conflict and the SameNameDirectoryOrFileExists error code. Otherwise, it overwrites the existing file.
string
No

Request Body

This API has no request body.

Response

Response Headers

This API only returns common response headers. For details, see Common Response Headers.

Response Body

The request is successful, returning application/xml data.
<MoveObjectResult>
<ETag>&#34;etag-value&#34;</ETag>
<LastModified>2025-01-15T10:30:00Z</LastModified>
<CRC64>xxx</CRC64>
</MoveObjectResult>
The detailed node descriptions are as follows:
Node Name (Keyword)
Parent Node
Description
Type
MoveObjectResult
None
Contains all information for the Move Object Recursive result.
Container
MoveObjectResult content of Container nodes:
Node Name (Keyword)
Parent Node
Description
Type
ETag
MoveObjectResult
The ETag value of the target object (enclosed in double quotes).
string
LastModified
MoveObjectResult
The last modification time of the target object, in RFC 3339 format.
date
CRC64
MoveObjectResult
The CRC64 value of the target object.
integer

Examples

Request

PUT /myspace/bbb HTTP/1.1
Host: smhxxx-1250000000.cos.ap-chengdu.myqcloud.com
x-cos-move-source: smhxxx-1250000000.cos.ap-chengdu.myqcloud.com/myspace/aaa
Authorization: q-sign-algorithm=sha1&q-ak=************************************&q-sign-time=1566302375;1566309575&q-key-time=1566302375;1566309575&q-header-list=content-length;content-md5;content-type;date;host&q-url-param-list=delete&q-signature=****************************************


Response

HTTP/1.1 200 OK
Content-Type: application/xml
Transfer-Encoding: chunked
Connection: keep-alive
Date: Tue, 20 Aug 2019 11:59:35 GMT
x-cos-request-id: NWQ1YmUwYTdfM2FiMDJhMDlfYzczN18zMGM1****

<MoveObjectResult>
<ETag>&#34;d-1780579801973809791&#34;</ETag>
<LastModified>2026-06-04T13:30:01Z</LastModified>
<CRC64>5404623458528365127</CRC64>
</MoveObjectResult>

Bantuan dan Dukungan

Apakah halaman ini membantu?

masukan