Obtains the metadata of an object in a bucket, including the ETag, Size, and LastModified. The content of the object is not returned.

Note
  • If the requested object is a symbol link, the information of the symbol link is returned.
  • The response to a GetObjectMeta request does not include a message body whether the request is successful.

Versioning

GetObjectMeta obtains the metadata of the current version of the target object by default. If the current version of the target object is a delete marker, the 404 Not Found error is returned. You can specify the versionId in the request to obtain the metadata of a specified version of the target object.

Request syntax

HEAD /ObjectName?objectMeta HTTP/1.1
Host: BucketName.oss-cn-hangzhou.aliyuncs.com
Date: GMT Date
Authorization: SignatureValue

Response headers

Header Type Description
Content-Length String

Indicates the size of the object.

ETag String

Indicates the ETag of the object, which is generated when an object is created to identify the content of the object.

For an object created by a PutObject request, its ETag is the MD5 value of its content. For an object created in other methods, its ETag is the UUID of its content. The ETag of an object can be used to check whether the content of the object changes. We recommend you do not use ETag as the MD5 value of an object to verify data integrity.

Default value: None

Examples

  • Normal request example:

    HEAD /oss.jpg?objectMeta HTTP/1.1
    Host: oss-example.oss-cn-hangzhou.aliyuncs.com
    Date: Wed, 29 Apr 2015 05:21:12 GMT
    Authorization: OSS qn6qrrqxo2oawuk53otfjbyc:CTkuxpLAi4XZ+WwIfNm0Fmgb****

    Response example:

    HTTP/1.1 200 OK
    x-oss-request-id: 559CC9BDC755F95A64485981
    Date: Wed, 29 Apr 2015 05:21:12 GMT
    ETag: "5B3C1A2E053D763E1B002CC607C5****"
    Last-Modified: Fri, 24 Feb 2012 06:07:48 GMT
    Content-Length: 344606
    Connection: keep-alive
    Server: AliyunOSS
  • Example of a request initiated to obtain the metadata of a specified version of the target object:

    GET /example?objectMeta&versionId=CAEQNRiBgIDMh4mD0BYiIDUzNDA4OGNmZjBjYTQ0YmI4Y2I4ZmVlYzJlNGVk**** HTTP/1.1
    Host: versioning-test.oss-cn-hangzhou.aliyuncs.com
    Date: Tue, 09 Apr 2019 06:24:00 GMT
    Authorization: OSS 5n4nrhyqrcs6ngn:i/M/c36KzrOEA/bBSHLllIAt****

    Response example:

    HTTP/1.1 200 OK
    x-oss-version-id: CAEQNRiBgIDMh4mD0BYiIDUzNDA4OGNmZjBjYTQ0YmI4Y2I4ZmVlYzJlNGVk****
    x-oss-request-id: 5CAC3A80B7AEADE0170005F6
    Date: Tue, 09 Apr 2019 06:24:00 GMT
    ETag: "1CF5A685959CA2ED8DE6E5F8ACC2****"
    Last-Modified: Tue, 09 Apr 2019 06:24:00 GMT
    Content-Length: 119914
    Connection: keep-alive
    Server: AliyunOSS

SDK

The SDKs of this API are as follows:

Error codes

Error code HTTP status code Description
Not Found 404 The requested object does not exist.