Description
The GET Bucket replication API is used to query the cross-region replication configuration in a bucket. When initiating the request, you need to obtain a request signature, indicating that the request is authorized.
Request
Request Example
GET /?replication HTTP/1.1
Host: <BucketName-APPID>.<Endpoint>
Date: GMT Date
Authorization: Auth String
Note:
Authorization: Auth String (For details, see Request Signature documentation).
Request Header
Common Headers
This request uses common request headers. For details, see Public Request Headers.
Non-common Headers
This request has no special request header information.
Request Body
The request does not have a request body.
Response
Response Headers
Common Response Headers
This response uses common response headers. For details, see Common Response Headers.
Special Response Headers
| Parameter | Type | Description |
|---|---|---|
| x-cos-replication-rule-creation-time | UTC timestamp format. | Creation time of a cross-region replication rule. |
Response Body
The response body is returned as application/xml. An example including the complete node data is shown below:
<ReplicationConfiguration>
<Role>qcs::cam::uin/[UIN]:uin/[Subaccount]</Role>
<Rule>
<Status></Status>
<ID></ID>
<Prefix></Prefix>
<Destination>
<Bucket>qcs::cos:[Region]::[BucketName-APPID]</Bucket>
</Destination>
</Rule>
</ReplicationConfiguration>
The specific contents are described as follows:
| Node Name (Keyword) | Parent Node | Description | Type | Required |
|---|---|---|---|---|
| ReplicationConfiguration | No | All cross-region replication configurations. | Container | Yes |
| Role | ReplicationConfiguration | Identifier of the initiator.qcs::cam::uin/<OwnerUin>:uin/<SubUin> |
String | Yes |
| Rule | ReplicationConfiguration | Specific configuration. You can set a maximum of 1,000 rules, which should apply to the same destination bucket. | Container | Yes |
| ID | ReplicationConfiguration.Rule | Identifies the name of a specific rule. | String | No |
| Status | ReplicationConfiguration.Rule | Indicates whether a rule takes effect. Enumerated values: Enabled and Disabled | String | Yes |
| Prefix | ReplicationConfiguration.Rule | Prefix matching policy. Policies cannot overlap; otherwise, an error will be returned. To match the root directory, leave this parameter empty. | String | Yes |
| Destination | ReplicationConfiguration.Rule | Destination bucket information. | Container | Yes |
| Bucket | ReplicationConfiguration.Rule.Destination | Resource identifier:qcs::cos:[region]::[bucketname-Appid] |
String | Yes |
| StorageClass | ReplicationConfiguration.Rule.Destination | Storage class. Enumerated values: Standard and Standard_IA; default value: original bucket class | String | No |
Error Analysis
The following table describes some common special errors that may occur with this request. For common error information, see Error Code.
| Error Code | Description | Status Code |
|---|---|---|
| ReplicationConfigurationNotFoundError | The configuration for cross-region replication is not found. | 404 Not Found |
Practical Case
Request
The following example queries the cross-region replication configuration from the originbucket-1250000000.
GET /?replication HTTP/1.1
Date: Fri, 14 Apr 2019 07:17:19 GMT
Authorization: q-sign-algorithm=sha1&q-ak=AKIDxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&q-sign-time=1503895278;1503895638&q-key-time=1503895278;1503895638&q-header-list=host&q-url-param-list=replication&q-signature=f77900be432072b16afd8222b4b349aabd837cb9
Host: <BucketName-APPID>.<Endpoint>
Content-Length: 0
Response
After receiving the request, COS returns the following response, indicating that the cross-region replication configuration in the bucket is enabled. In the rule configuration, the copied content is all objects with the prefix testPrefix in the bucket originbucket-1250000000. By default, the storage type of object replicas is the same as that of the objects in the source bucket.
Content-Type: application/xml
Content-Length: 309
Connection: keep-alive
Date: Fri, 14 Apr 2019 07:17:19 GMT
x-cos-replication-rule-creation-time: Fri, 14 Apr 2019 07:06:19 GMT
x-cos-request-id: NWQwMzQ5ZmZfMjBiNDU4NjRfNjAwOV84MzA2MjE=
<ReplicationConfiguration>
<Role>qcs::cam::uin/100000000001:uin/100000000001</Role>
<Rule>
<Status>Enabled</Status>
<ID>RuleId_01</ID>
<Prefix>testPrefix</Prefix>
<Destination>
<Bucket>qcs::cos:ap-[Region]::destinationBucket-1250000000</Bucket>
</Destination>
</Rule>
</ReplicationConfiguration>