GetObjectMeta

更新时间:
复制 MD 格式

The GetObjectMeta operation retrieves the metadata of an object, including its ETag, size, and last-modified time, without returning the object content.

Notes

Note

If the object is a symbolic link, the symbolic link metadata is returned.

If versioning is disabled, you must have the oss:GetObject permission. If versioning is enabled, you must have the oss:GetObjectVersion permission to retrieve metadata of a specific version. Specify the version with the x-oss-version-id request header. Grant custom permissions to a RAM user.

Versioning

By default, GetObjectMeta retrieves metadata of the current version. If the current version is a delete marker, OSS returns 404 Not Found. If you specify a versionId in the request, metadata of that version is returned.

Request syntax

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

当您在OSS ON云盒中调用该接口时,您需要将Host替换为云盒Endpoint。更多信息,请参见云盒Endpoint

Request headers

DescribeRegions uses only common request headers. For more information, see Common request headers.

Response headers

Response header

Type

Example

Description

Content-Length

String

344606

The size of the object in bytes.

ETag

String

5B3C1A2E053D763E1B002CC607C5****

An ETag (entity tag) is generated when an object is created to identify its content.

For objects created by PutObject, the ETag is the MD5 hash of the content. For objects created by other methods, the ETag is a unique value but not the MD5 hash. Use the ETag to check whether content has changed, but not for MD5 validation of data integrity.

Default value: None

x-oss-transition-time

String

Tue, 23 Apr 2024 07:21:42 GMT

The time when a lifecycle rule converted the object to Cold Archive or Deep Cold Archive.

Note
  • If you delete a Cold Archive or Deep Cold Archive object more than 180 days after it is converted, no early deletion fee is charged. If you delete the object within 180 days after it is converted, an early deletion fee is charged.

  • This field cannot be used to determine the time when an object is converted to the IA or Archive storage class by a lifecycle rule. Whether an IA or Archive object meets the minimum storage duration requirement depends on the Last-Modified time.

x-oss-last-access-time

String

Tue, 30 Mar 2021 06:07:48 GMT

The last access time of the object in GMT format (HTTP 1.1). Returned only when access tracking is enabled. Updated when the object is accessed.

Important

Last access time is updated asynchronously. OSS typically updates it within 24 hours. If an object is accessed multiple times within 24 hours, only the earliest access time is recorded.

Last-Modified

String

Fri, 24 Feb 2012 06:07:48 GMT

The time when the object was last modified, in GMT format (HTTP 1.1).

Note
  • The minimum storage duration for objects in the Infrequent Access storage class is 30 days. The duration is calculated from the Last-Modified time of the object. If you delete an object more than 30 days after its Last-Modified time, no early deletion fee is charged.

  • The minimum storage duration for objects in the Archive Storage class is 60 days. The duration is calculated from the Last-Modified time of the object. If you delete an object more than 60 days after its Last-Modified time, no early deletion fee is charged.

x-oss-version-id

String

CAEQNRiBgIDMh4mD0BYiIDUzNDA4OGNmZjBjYTQ0YmI4Y2I4ZmVlYzJlNGVk****

The version ID of the object. This field is returned only when you obtain the metadata of a specific version of an object.

x-oss-sealed-time

String

Sat, 11 Oct 2025 06:41:42 GMT

The time when the seal operation was performed on the appendable object, in GMT format (HTTP 1.1). Returned only for sealed appendable objects.

This operation also returns Common response headers.

Examples

  • Versioning disabled

    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: OSS4-HMAC-SHA256 Credential=LTAI********************/20250417/cn-hangzhou/oss/aliyun_v4_request,Signature=a7c3554c729d71929e0b84489addee6b2e8d5cb48595adfc51868c299c0c218e

    Response example

    • Access tracking disabled

      HTTP/1.1 200 OK
      x-oss-request-id: 559CC9BDC755F95A6448****
      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
    • Access tracking enabled

      HTTP/1.1 200 OK
      x-oss-request-id: 559CC9BDC755F95A6448****
      Date: Wed, 29 Apr 2015 05:21:12 GMT
      ETag: "5B3C1A2E053D763E1B002CC607C5****"
      x-oss-transition-time: Tue, 23 Apr 2024 07:21:42 GMT
      x-oss-last-access-time: Thu, 14 Oct 2021 11:49:05 GMT
      Last-Modified: Fri, 24 Feb 2012 06:07:48 GMT
      Content-Length: 344606
      Connection: keep-alive
      Server: AliyunOSS
  • Versioning enabled

    Request example

    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: OSS4-HMAC-SHA256 Credential=LTAI********************/20250417/cn-hangzhou/oss/aliyun_v4_request,Signature=a7c3554c729d71929e0b84489addee6b2e8d5cb48595adfc51868c299c0c218e

    Response example

    • Access tracking disabled

      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
    • Access tracking enabled

      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****"
      x-oss-last-access-time: Thu, 14 Oct 2021 11:49:05 GMT
      Last-Modified: Tue, 09 Apr 2019 06:24:00 GMT
      Content-Length: 119914
      Connection: keep-alive
      Server: AliyunOSS

SDK

You can call this operation by using the following SDKs:

Command line interface ossutil

The corresponding ossutil command is get-object-meta.

References

Manage object metadata

Error codes

Error code

HTTP status code

Description

Not Found

404

The specified object does not exist.