HeadObject

Last update:2022-03-01 18:01:08

Send HEAD request to get metadata of the object. No file content is returned this way. IAM wos:HeadObject permission is required.

Request syntax

HEAD /ObjectName HTTP/1
Host: Bucket.Endpoint
Date: date
Authorization: authorization

URI request parameters

None

Request header

In addition to Common Request Headers, it also contains

Name Description Required
If-Match If ETag in request matches that of the object in bucket specified by the request, metadata of the object is returned, otherwise 412 ( precondition failed ) is returned.
Type: string. ( ETag value, example: 0f64741bf7cb1089e988e4585d0d3434 )
No
If-Modified-Since Only when the object has ever been modified before time of If-Modified-Since, will metadata of the object be returned, otherwise, 304 (not modified) is returned.
Type: string.
No
If-Unmodified-Since Only when the object has never been modified after time of If-Unmodified-Since, will metadata of the object be returned, otherwise, 304 (not modified) is returned.
Type: string
No
If-None-Match If ETag in request does not match that of the object in bucket specified by the request, the content of the object is returned, otherwise 304 ( not modified ) is returned.
Type: String. ( ETag value, example: 0f64741bf7cb1089e988e4585d0d3434 )
No
Range Get the content of object within the Range. If the Range is invalid , 416 Requested Range Not Satisfiable will be reported . The Range is [0, maxlength-1).
Type: String. ( bytes=byte_range, for example: bytes=0-4 or bytes=512-1024 .)
No

Request body

None

Response syntax

HTTP/1.1 status_code

x-amz-request-id: request id
Content-Type: type
Date: date
Content-Length: length
Etag: etag
Last-Modified: time
Server: WS-web-server

Response header

In addition to common response headers , you can use the following headers as well.

Name Description
Etag Entity tag of the uploaded object.
x-amz-meta-* Customized metadata.

Response body

None

Special error

Http Status Error Code Message
416 Requested Range Not Satisfiable InvalidRange The requested range cannot be satisfied.

Example

HEAD /objectName HTTP/1.1

User-Agent: Jakarta Commons-HttpClient/1
Host: bucket.s3-cn-east-1.wcsapi.com
Accept: */*
Date: Sat, 03 Dec 2011 09:17:57 +0000
Authorization: WOS BF6C09F302931425E9A7:++6NkzwVhw4qccNfIqf4G2vMggg=


HTTP/1.1 200 OK

x-amz-request-id: 001B21A61C6C0000013403373811529D
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
Server: WS-web-server
Is the content of this document helpful to you?
Yes
I have suggestion
Submitted successfully! Thank you very much for your feedback, we will continue to strive to do better!