All Products
Search
Document Center

Object Storage Service:GetBucketLocation

Last Updated:Sep 20, 2023

Queries the region of an Object Storage Service (OSS) bucket. Only the bucket owner can query the region of a bucket.

Request syntax

GET /?location HTTP/1.1
Host: BucketName.oss-cn-hangzhou.aliyuncs.com
Date: GMT Date
Authorization: SignatureValue

Request headers

This request contains only common request headers. For more information, see Common HTTP headers.

Response headers

This request contains only common response headers. For more information, see Common HTTP headers.

Response elements

Element

Type

Example

Description

LocationConstraint

String

oss-cn-hangzhou

The region in which the bucket is located.

Note

For more information about regions and endpoints, see Regions and endpoints.

Examples

Sample request

Get /?location HTTP/1.1
Host: examplebucket.oss-cn-hangzhou.aliyuncs.com
Date: Fri, 04 May 2012 05:31:04 GMT  
Authorization: OSS qn6qrrqxo2oawuk53otf****:ceOEyZavKY4QcjoUWYSpYbJ3****                

Sample response

HTTP/1.1 200
x-oss-request-id: 534B371674E88A4D8906****
Date: Fri, 15 Mar 2013 05:31:04 GMT
Connection: keep-alive
Content-Length: 90 
Server: AliyunOSS

<?xml version="1.0" encoding="UTF-8"?>
<LocationConstraint>oss-cn-hangzhou</LocationConstraint >

SDK

You can use OSS SDKs for the following programming languages to call the GetBucketLocation operation:

Error codes

Error code

HTTP status code

Description

AccessDenied

403

You are not authorized to query the region of the bucket. Only the bucket owner can query the region of a bucket.