HEAD Bucket

Last updated: 2019-10-24 18:53:56

PDF

Description

This API (Head Bucket) is used to check whether a bucket exists and you have permission to access it. Possible situations include:

  • If the bucket exists and you have read permission to it, HTTP status code 200 will be returned.
  • If you have no permission to read the bucket, HTTP status code 403 will be returned.
  • If the bucket does not exist, HTTP status code 404 will be returned.

Request

Sample Request

HEAD / HTTP/1.1
Host: <BucketName-APPID>.cos.<Region>.myqcloud.com
Date: GMT Date
Authorization: Auth String

Authorization: Auth String (see Request Signature for details).

Request Parameters

This API has no request parameters.

Request Header

This API uses only a common request header. For more information on common request headers, see Common Request Headers.

Request Body

This API has no request body.

Response

Response Header

In addition to common response headers, this API returns the following response headers. For more information, see Common Response Headers.

Name Description Type
x-cos-bucket-region Bucket region such as ap-beijing, ap-hongkong, and eu-frankfurt. For the enumerated values, see Regions and Access Domain Names Enum

Response Body

The response body of this API is empty.

Error Codes

There are no special error messages for this API. For all error messages, see Error Codes.

Sample

Request

HEAD / HTTP/1.1
Host: examplebucket-1250000000.cos.ap-beijing.myqcloud.com
Date: Tue, 28 May 2019 03:16:12 GMT
Authorization: q-sign-algorithm=sha1&q-ak=AKID8A0fBVtYFrNm02oY1g1JQQF0c3JO****&q-sign-time=1559013372;1559020572&q-key-time=1559013372;1559020572&q-header-list=date;host&q-url-param-list=&q-signature=9085930afacf1e8a0ade2697b69353b27901****
Connection: close

Response

HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: 0
Connection: close
Date: Tue, 28 May 2019 03:16:12 GMT
Server: tencent-cos
x-cos-bucket-region: ap-beijing
x-cos-request-id: NWNlY2E3ZmNfZjhjMDBiMDlfMTBjOWRfZDcz****