GET Bucket location

Last updated: 2024-11-22 10:58:31

Feature Overview

This API is used to query which region a bucket resides in. This GET request obtains the region with the location parameter. Only the bucket owner has permission to call this API.

Requests

Sample Request

GET /?location HTTP/1.1
Host: <Bucketname-APPID>.cos.<Region>.myqcloud.com
Date: GMT Date
Authorization: Auth String
Note
Host: <BucketName-APPID>.cos.<Region>.myqcloud.com, where <BucketName-APPID> is the bucket name with the APPID suffix, such as examplebucket-1250000000. You can refer to the Bucket Overview > Basic Information and Bucket Overview > Bucket Naming Convention documentation. <Region> represents the available regions for COS, which can be found in the Regions and Access Domain Names documentation.
Authorization: Auth String (For more information, see Request Signature).

Request Header

Common Header

This API uses common request headers. For more information, see Common Request Headers.

Non-common Header

This request operation has no special request headers.

Request Body

The request body of this request is empty.

Response

Response Header

Common Response Header

Special Response Header

This response has no special response headers.

Response Body

The region is returned in the response body.
<?xml version="1.0" encoding="UTF-8" ?>
<LocationConstraint>cos.ap-beijing</LocationConstraint>
The nodes are described as follows:
Node Name (Keyword)
Parent Node
Description
Local Disk Types
Required
LocationConstraint
-
Specify the bucket's region, with enumerated values referring to the Regions and Access Domain Names document, such as: ap-beijing, ap-hongkong, eu-frankfurt, etc.
string
Required

Error Codes

There are no specific error messages for this request operation. For common error messages, see Error Codes.

Examples

Requests

GET /?location HTTP/1.1
Host: examplebucket-1250000000.cos.ap-beijing.myqcloud.com
Date: Wed, 18 Oct 2014 22:32:00 GMT
Authorization: q-sign-algorithm=sha1&q-ak=************************************&q-sign-time=1484817522;32557713522&q-key-time=1484817522;32557713522&q-header-list=host&q-url-param-list=location&q-signature=***********************************************

Response

HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: 92
Connection: keep-alive
Date: Wed, 18 Oct 2014 22:32:00 GMT
Server: tencent-cos
x-cos-request-id: NTg4MDg0NzlfNDYyMDRlXzM0OWFf****

<LocationConstraint>cos.ap-beijing</LocationConstraint>