Obtaining Bucket Metadata¶
Functions¶
This operation queries the metadata of a bucket. To use this operation, you must have the permission to read the bucket.
Request Syntax¶
HEAD / HTTP/1.1
Host: bucketname.obs.region.example.com
Date: date
Authorization: authorization
Request Parameters¶
This request contains no parameters.
Request Headers¶
This request uses common headers. For details, see Table 3. You can also use the header in Table 1.
If you want to get CORS configuration information, you must use the headers in Table 2.
Header | Type | Mandatory (Yes/No) | Description |
|---|---|---|---|
x-obs-request-payer | string | No | Definition: Indicates that the requester agrees to pay for the request and traffic. Constraints: If this header is not included in the request when the requester tries to access a requester-pays bucket, the authentication fails and error "403 Forbidden" is returned. Range: requester Default value: None |
Header | Type | Mandatory (Yes/No) | Description |
|---|---|---|---|
Origin | String | Yes | Definition: Origin of the cross-domain request specified by the pre-request. Generally, it is a domain name. Constraints: You can enter multiple origins, with one separated from another using a line break. Each origin can contain at most one wildcard character (*). Range: An HTTP-compliant header value Default value: None |
Access-Control-Request-Headers | String | No | Definition: HTTP headers in a request Constraints: You can enter multiple allowed headers, with one separated from another using a line break. Each header can contain one wildcard character ( Range: An HTTP-compliant header value Default value: None |
Request Elements¶
This request contains no elements.
Response Syntax¶
HTTP/1.1 status_code
x-obs-bucket-location: region
Date: date
Response Headers¶
The response to the request uses common headers. For details, see Table 1.
In addition to the common response headers, the headers listed in Table 3 may be used.
Header | Type | Description |
|---|---|---|
x-obs-bucket-location | String | Definition: The region where the bucket resides. Constraints: None Range: None Default value: None |
x-obs-storage-class | String | Definition: Default storage class of the bucket. Constraints: None Range:
Default value: None |
x-obs-version | String | Definition: OBS version of the bucket. Constraints: None Range:
Default value: None |
x-obs-fs-file-interface | String | Definition: Whether it is a parallel file system Constraints: If this header field is not carried, the bucket is not a parallel file system. Range: The value can be Enabled (parallel file system). Default value: None |
Access-Control-Allow-Origin | String | Definition: Indicates that the origin is included in the response if the origin in the request meets the CORS configuration requirements when CORS is configured for buckets. Constraints: None Range: The value that complies with the CORS Default value: None |
Access-Control-Allow-Headers | String | Definition: Indicates that the headers are included in the response if headers in the request meet the CORS configuration requirements when CORS is configured for buckets. Constraints: None Range: The value that complies with the CORS Default value: None |
Access-Control-Max-Age | Integer | Definition: Value of MaxAgeSeconds in the CORS configuration of the server when CORS is configured for buckets. Constraints: None Range: An integer greater than or equal to 0, in seconds Default value: 3000 |
Access-Control-Allow-Methods | String | Definition: Indicates that methods in the rule are included in the response if Access-Control-Request-Method in the request meets the CORS configuration requirements when CORS is configured for buckets. Constraints: None Range:
Default value: None |
Access-Control-Expose-Headers | String | Definition: ExposeHeader in the CORS rules of the bucket. It specifies additional headers allowed in the response by a CORS rule, which are used to provide extra information to clients. By default, a browser can access only headers Content-Length and Content-Type. If the browser needs to access other headers, you need to configure them in this parameter. Constraints: Spaces, wildcard characters ( Range: None Default value: None |
x-obs-request-payer | string | Definition: Indicates that the requester agrees to pay for the request and traffic. Constraints: If this header is not included in the request when the requester tries to access a requester-pays bucket, the authentication fails and error "403 Forbidden" is returned. Range: requester Default value: None |
Response Elements¶
This response contains no elements.
Error Responses¶
No special error responses are returned. For details about error responses, see Table 2.
Sample Request: Getting CORS Configuration (with No Headers Specified)¶
HEAD / HTTP/1.1
User-Agent: curl/7.29.0
Host: examplebucket.obs.region.example.com
Accept: */*
Date: WED, 01 Jul 2015 02:30:25 GMT
Authorization: OBS H4IPJX0TQTHTHEBQQCEC:niCQCuGIZpETKIyx1datxHZyYlk=
Sample Response: Getting CORS Configuration (with No Headers Specified)¶
HTTP/1.1 200 OK
Server: OBS
x-obs-request-id: BF260000016439C734E0788404623FA8
Content-Type: application/xml
x-obs-storage-class: STANDARD
x-obs-id-2: 32AAAQAAEAABAAAQAAEAABAAAQAAEAABCSxwLpq9Hzf3OnaXr+pI/OPLKdrtiQAF
Date: WED, 01 Jul 2015 02:30:25 GMT
x-obs-bucket-location: region
x-obs-version: 3.0
Content-Length: 0
Sample Request: Getting Bucket Metadata and CORS Configuration¶
HEAD / HTTP/1.1
User-Agent: curl/7.29.0
Host: examplebucket.obs.region.example.com
Accept: */*
Date: WED, 01 Jul 2015 02:30:25 GMT
Authorization: OBS H4IPJX0TQTHTHEBQQCEC:niCQCuGIZpETKIyx1datxHZyYlk=
Origin:www.example.com
Access-Control-Request-Headers:AllowedHeader_1
Sample Response: Getting Bucket Metadata and CORS Configuration¶
HTTP/1.1 200 OK
Server: OBS
x-obs-request-id: BF260000016439C734E0788404623FA8
Content-Type: application/xml
x-obs-storage-class: STANDARD
x-obs-id-2: 32AAAQAAEAABAAAQAAEAABAAAQAAEAABCSxwLpq9Hzf3OnaXr+pI/OPLKdrtiQAF
Date: WED, 01 Jul 2015 02:30:25 GMT
x-obs-bucket-location: region
Access-Control-Allow-Origin: www.example.com
Access-Control-Allow-Methods: POST,GET,HEAD,PUT
Access-Control-Allow-Headers: AllowedHeader_1
Access-Control-Max-Age: 100
Access-Control-Expose-Headers: ExposeHeader_1
x-obs-version: 3.0
Content-Length: 0