HEAD Object

最近更新时间:2020-07-10 09:12:26

HEAD Object


Description

This HEAD operation will get the metadata information of the object without returning the object. If you only need the metadata information of the object, this method is very suitable. Using this interface, you need to have READ permission on the object.

The HEAD request of an object has the same operation as the GET request, the only difference is that the HEAD request does not have a response body in the response reply.

Permissions

This interface operation requires the user to have READ permission on the Object. If the requested object does not exist, KS3 will return the corresponding information according to whether you have permission.

  • If you have READ permission of the Bucket, KS3 will return an HTTP status code of 404 (no such key) error.
  • If you do not have READ permission of the Bucket, KS3 will return an HTTP status code of 403 (access denied) error.

Requests

Syntax

HEAD /{ObjectKey} HTTP/1.1
Host: {BucketName}.{endpoint}
Date: {date}
Authorization: {SignatureValue}

Attention:

Request Parameters

The interface does not use the request header.

Request Headers

This interface can use all the common request headers. In addition, it can also use the request headers listed in the following table. For more information, click on Public Request Headers.

Name Description Required
Range Download the object of the specified range byte. For more information about the HTTP Range header, please visit http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html## sec14.35
Type:String
Default:None
Constraints:None
No
If-Modified-Since If the object is changed after the specified time, the object is returned. Otherwise, 304 status code is returned.
Type:String
Default:None
Constraints:None
No
If-Unmodified-Since If the object is not changed after the specified time, the object is returned. Otherwise, 412 status code is returned.
Type:String
Default:None
Constraints:None
No
If-Match If the ETag(entity tag) of the object is the same as the specified value, the object is returned. Otherwise, 412 status code is returned.
Type:String
Default:None
Constraints:None
No
If-None-Match If the ETag(entity tag) of the object is inconsistent with the specified value, the object is returned. Otherwise, 304 status code is returned.
Type:String
Default:None
Constraints:None
No

Request Elements

The interface does not use request elements.

Responses

Response Headers

Name Description
Content-MD5 Returns the base64 encoding of the MD5 value of the file, provided that the file is uploaded to KS3 through PUT or POST. If the file is uploaded in blocks, this response header will not be returned.
x-kss-meta-* 如If you use the user metadata in the PUT Object with the format of prefix x-kss-meta- suffix as your own field, the response header will return it without parsing.
Type:String
x-kss-restore When requesting the head of the unfrozen or unfrozen archive files, an x-kss-restore request header will be added.The content of the request header indicates the unfrozen status and the unfreezing expiration time. The files in unfreezing will return x-kss-restore: ongoing-request="true", and the unfrozen files will return, for example:x-kss-restore: ongoing-request="false", expiry-date="Sun, 16 Apr 2017 08:12:33 GMT". For standard storage files, low-frequency storage files and archive files that have not been unfrozen, the x-kss-restore request header will not be added when the head request is made.
Type:String
x-kss-storage-class If the file storage class is infrequent access storage, the value is STANDARD_IA. If the file storage class is archive storage, the value is ARCHIVE. If the file storage class is standard storage, the response header is not returned.
Type:String
ETag The 32-bit hexadecimal string used to identify the content of an Object. Object with different contents correspond to different ETag. For the Object created Put Object or Post Object request, the ETag value is the MD5 value of its content. For the Object created by block upload method, the ETag value is the MD5 value of each block after string splicing. The ETag value can be used to check whether the Object content has changed.
Type: String

Response Elements

The interface does not return response elements.

Special Errors

The interface does not return any special errors.

Examples

Sample Request

HEAD /my-image.jpg HTTP/1.1
Host: ks3-example.ks3-cn-beijing.ksyun.com
Date: Wed, 28 Oct 2009 22:32:00 GMT
Authorization: authorization string

Sample Response

HTTP/1.1 200 OK
Date: Wed, 28 Oct 2009 22:32:00 GMT
Last-Modified: Sun, 1 Jan 2006 12:00:00 GMT
ETag: "54a3be97af36cdc9f2516c74550fa95d"
Content-Length: 434234
Content-Type: text/plain
Connection: close
Server: Tengine
Content-MD5:VKO+l682zcnyUWx0VQ+pXQ==

Attention:

  1. If the file is saved in KS3 through block upload, the Content_MD5 response header will not be returned when the get interface is called for the file

  2. If the file is uploaded to KS3 through the PUT or POST interface, calling the GET interface on the file will return the Content_MD5 response header

Interface Detail Analysis

  • No matter whether the request is successful or not, the HEAD Object will not return the body
  • This interface can be used to determine whether an object exists
  • This interface can be used to obtain the metadata of an object

金山云,开启您的云计算之旅

免费注册