Reviewed-by: Hasko, Vladimir <vladimir.hasko@t-systems.com> Co-authored-by: Jawei, Li <lijiawei5@huawei.com> Co-committed-by: Jawei, Li <lijiawei5@huawei.com>
27 KiB
HEAD Object
You can use this operation to view an object's metadata, as long as you have READ permission for the object.
This operation makes server-side encryption available.
Versioning
By default, the metadata of the object of the latest version is obtained. If the version ID of the object is a deletion mark, 404 is returned. You can specify versionId to obtain the metadata of an object of the desired version.
Request Syntax
HEAD /ObjectName HTTP/1.1 User-Agent: agent Host: bucketname.obs.example.com Accept: */* Date: date Authorization: authorization
Request Parameters
Table 1 describes the request parameter.
Request Headers
This request uses common headers. For details about common request headers, see section Common Request Headers.
If you want to obtain CORS configuration information, you must use the headers in Table 2.
Header |
Description |
Remarks |
---|---|---|
Origin |
Indicates an origin specified by a pre-request. Generally, it is a domain name. Type: String |
Mandatory |
Access-Control-Request-Headers |
Indicates the HTTP headers of a request. The request can use multiple HTTP headers. Type: String |
Optional |
x-amz-server-side-encryption-customer-algorithm |
Indicates a decryption algorithm. The header is used in SSE-C mode. Type: string Example: x-amz-server-side-encryption-customer-algorithm:AES256 Constraints: This header must be used together with x-amz-server-side-encryption-customer-key and x-amz-server-side-encryption-customer-key-MD5. |
No. This header is mandatory when SSE-C is used. |
x-amz-server-side-encryption-customer-key |
Indicates a key used to decrypt objects. The header is used in SSE-C mode. Type: string Example: x-amz-server-side-encryption-customer-key:K7QkYpBkM5+hcs27fsNkUnNVaobncnLht/rCB2o/9Cw= Constraints: This header is a base64-encoded 256-bit or 512-bit key and must be used together with x-amz-server-side-encryption-customer-algorithm and x-amz-server-side-encryption-customer-key-MD5. |
No. This header is mandatory when SSE-C is used. |
x-amz-server-side-encryption-customer-key-MD5 |
Indicates the MD5 value of a key used to decrypt objects. The header is used in SSE-C mode. The MD5 value is used to check whether any error occurs during the transmission of the key. Type: string Example: x-amz-server-side-encryption-customer-key-MD5:4XvB3tbNTN+tIEVa0/fGaQ== Constraints: This header is a base64-encoded 128-bit MD5 value and must be used together with x-amz-server-side-encryption-customer-algorithm and x-amz-server-side-encryption-customer-key. |
No. This header is mandatory when SSE-C is used. |
x-amz-security-token |
Header field used to identify the request of a federated user. When the federal authentication function is enabled, users sending such requests are identified as federated users. Type: string |
Optional. This parameter must be carried in the request sent by federated users. |
Request Elements
This request involves no elements.
Response Syntax
HTTP/1.1 status_code Server: Server Name x-amz-request-id: request id x-amz-id-2: id x-reserved: amazon, aws and amazon web services are trademarks or registered trademarks of Amazon Technologies, Inc Accept-Ranges: bytes Content-Type: type Date: date Content-Length: length Etag: etag Last-Modified: time
Response Headers
This response uses common headers. For details about common response headers, see section Common Response Headers.
This response can also include an optional header. Table 3 describes the header.
Header |
Description |
---|---|
x-amz-expiration |
This header is included in the response if the object expiration is configured. This header includes expiry-date and rule-id key value pairs to provide object expiration information. Type: String |
x-amz-website-redirect-location |
When a bucket is configured as a website, you can set this metadata for the object so that the website endpoint will evaluate the request for the object as a 301 redirect to another object in the same bucket or an external URL. Type: String |
x-amz-version-id |
Indicates the version ID of an object. If an object has no version ID specified, this header is not returned. Valid values: String Default: None |
Access-Control-Allow-Origin |
CORS is configured for buckets. If Origin in the request meets the CORS configuration requirements, Origin is included in the response. Type: String |
Access-Control-Allow-Headers |
CORS is configured for buckets. If headers in the request meet the CORS configuration requirements, headers are included in the response. Type: String |
Access-Control-Max-Age |
Indicates MaxAgeSeconds in the CORS configuration of a server when CORS is configured for buckets. Type: Integer |
Access-Control-Allow-Methods |
CORS is configured for buckets. If Access-Control-Request-Method in the request meets the CORS configuration requirements, methods in the rule are included in the response. Type: String Valid values: GET, PUT, HEAD, POST, and DELETE |
Access-Control-Expose-Headers |
Indicates ExposeHeader in the CORS configuration of a server when CORS is configured for buckets. Type: String |
x-amz-server-side-encryption |
This header is included in a response if SSE-KMS is used. Type: string Example: x-amz-server-side-encryption:aws:kms |
x-amz-server-side-encryption-aws-kms-key-id |
Indicates the master key ID. This header is included in a response if SSE-KMS is used. Example: x-amz-server-side-encryption-aws-kms-key-id:arn:aws:kms:sichuan:domainiddomainiddomainiddoma0001:key/4f1cd4de-ab64-4807-920a-47fc42e7f0d0 |
x-amz-server-side-encryption-customer-algorithm |
Indicates a decryption algorithm. This header is included in a response if SSE-C is used. Type: string Example: x-amz-server-side-encryption-customer-algorithm:AES256 |
x-amz-server-side-encryption-customer-key-MD5 |
Indicates the MD5 value of a key used to decrypt objects. This header is included in a response if SSE-C is used. Type: string Example: x-amz-server-side-encryption-customer-key-MD5:4XvB3tbNTN+tIEVa0/fGaQ== |
x-amz-storage-class |
This header is returned when the storage class of an object is not Standard. Type: String Valid values: STANDARD_IA and GLACIER |
x-amz-restore |
The following provides examples of object restoration status:
Type: String |
Response elements
This response involves no elements.
Error Responses
No special error responses are returned. For details about error responses, see Table 1.
Sample Request
HEAD /test HTTP/1.1 User-Agent: Jakarta Commons-HttpClient/3.1 Host: bucketname.obs.example.com Accept: */* Date: Sat, 03 Dec 2011 09:17:57 +0000 Authorization: AWS BF6C09F302931425E9A7:++6NkzwVhw4qccNfIqf4G2vMggg=
Sample Response
HTTP/1.1 200 OK Server: OBS x-amz-request-id: 001B21A61C6C0000013403373811529D x-amz-id-2: MDAxQjIxQTYxQzZDMDAwMDAxMzQwMzM3MzgxMTUyOURBQUFBQUFBQWJiYmJiYmJi x-reserved: amazon, aws and amazon web services are trademarks or registered trademarks of Amazon Technologies, Inc Accept-Ranges: bytes ETag: "507e3fff69b69bf57d303e807448560b" Last-Modified: Sat, 03 Dec 2011 08:47:50 GMT Content-Length: 30 Content-Type: binary/octet-stream Date: Sat, 03 Dec 2011 09:17:57 GMT
Sample Request (Getting the Metadata of an Object with Version ID Specified)
HEAD /object?versionId=AAABQ4-glIvc0vycq3gAAAAVVURTRkha HTTP/1.1 User-Agent: Jakarta Commons-HttpClient/3.1 Host: bucketname.obs.example.com Accept: */* Date: Tue, 14 Jan 2014 07:22:17 +0000 Authorization: AWS C9590CEB8EC051BDEC9D:CTunmEJMuOBqUa4zfJNz6zxkjBE=
Sample Response (Getting the Metadata of an Object with Version ID Specified)
HTTP/1.1 200 OK Server: OBS x-amz-request-id: DCD2FC9CAB78000001438FA11E6CBB07 x-amz-id-2: SSfKQyh2Gr6ygerqHhJLZ6rxPiv+ucjWabr48RssNJMWmGyKh9gDdXC0jvo1JmFs x-reserved: amazon, aws and amazon web services are trademarks or registered trademarks of Amazon Technologies, Inc Accept-Ranges: bytes ETag: "ba1f2511fc30423bdbb183fe33f3dd0f" Last-Modified: Tue, 14 Jan 2014 07:21:42 GMT Content-Length: 4 x-amz-version-id: AAABQ4-glIvc0vycq3gAAAAVVURTRkha Content-Type: binary/octet-stream Date: Tue, 14 Jan 2014 07:22:17 GMT
Sample Request (Getting Object Metadata and CORS Configuration when CORS is properly configured)
HEAD /object HTTP/1.1 User-Agent: curl/7.19.0 (x86_64-suse-linux-gnu) libcurl/7.19.0 OpenSSL/0.9.8{ zlib/1.2.3 libidn/1.10 Host: bucketname.obs.example.com Accept: */* Date: Tue, 28 Apr 2015 14:03:45 +0000 Authorization: AWS D13E0C94E722DD69423C:YcuaA/lJkmWn8AqjfWvIodNJ/yM= Origin:www.example.com Access-Control-Request-Headers:AllowedHeader_1
Sample Response (Getting Object Metadata and CORS Configuration when CORS is properly configured)
HTTP/1.1 200 OK x-amz-request-id: D168613B12D6EE5744A69C524D3AA876 x-amz-id-2: 35Sas+J9yUY4xz3PrL0O938UKDg+Dc8EfSw0m9LtfoqB7s0wiMc44TOGguSLNyOv x-reserved: amazon, aws and amazon web services are trademarks or registered trademarks of Amazon Technologies, Inc Access-Control-Allow-Origin: www.example.com Access-Control-Allow-Methods: POST,GET,HEAD,PUT,DELETE Access-Control-Allow-Headers: AllowedHeader_1 Access-Control-Max-Age: 100 Access-Control-Expose-Headers: ExposeHeader_1 Accept-Ranges: bytes ETag: "6bcb16084a88ae550811429c0c1e8bc7" Last-Modified: Tue, 28 Apr 2015 13:38:05 GMT Content-Length: 264 Content-Type: binary/octet-stream Date: Tue, 28 Apr 2015 14:03:45 GMT