• Object Storage Service

obs
  1. Help Center
  2. Object Storage Service
  3. API Reference (OBS)
  4. Operations on Objects
  5. GET Object
  6. Requests

Requests

Syntax

GET /ObjectName HTTP/1.1 
 User-Agent: agent
 Host: bucketname.obs.example.com 
 Accept: */* 
 Date: date 
 Authorization: authorization 
 Range:bytes=byte_range 
 <Optional Additional Header>
NOTE:

In this request, header Range is optional. If this header is not specified, all data of an object is returned.

Request Parameters

In a GET request, you can override values for a set of response headers using the request parameters listed in Table 1. Response headers that you can override are Content-TypeContent-LanguageExpiresCache-ControlContent-Disposition, and Content-Encoding.

Table 1 Request parameters

Parameter

Description

Remarks

response-content-type

Overrides the Content-Type header in the response.

Type: String

Optional

response-content-language

Overrides the Content-Language header in the response.

Type: String

Optional

response-expires

Overrides the Expires header in the response.

Type: String

Optional

response-cache-control

Overrides the Cache-Control header in the response.

Type: String

Optional

response-content-disposition

Overrides the Content-Disposition header in the response.

Type: String

Optional

response-content-encoding

Overrides the Content-Encoding header in the response.

Type: String

Optional

versionId

Specifies the version ID of the object whose content is obtained.

Type: String

Optional

Request Headers

This request uses common headers. For details about common request headers, see section Common Request Headers. In addition, you can add optional headers to this request. Table 2 describes the optional headers.

Table 2 Optional request headers

Header

Description

Remarks

Range

Obtains the specified range bytes of an object. The value is a range starting from 0 to maximum object length minus one. If the range is invalid, all object data is returned.

Type: String

Note:

The header format for a single range is bytes=byte_range, for example, bytes=0-4 or bytes=512-1024. The header format for multiple ranges is, for example, bytes=10-20,30-40. If there are multiple ranges, the output is as follows:

--5926640d-5ca3-4e56-a9e9-5493dab2da66

Content-type: binary/octet-stream

Content-range: bytes 10-20/7279

xxxx

--5926640d-5ca3-4e56-a9e9-5493dab2da66

Content-type: binary/octet-stream

Content-range: bytes 30-40/7279

yyyy

NOTE:

--5926640d-5ca3-4e56-a9e9-5493dab2da66-- is a randomly generated character string and functions as a separator.

Content-type indicates the type of the range data.

Content-range indicates the data range or the total object size.

Optional

If-Modified-Since

Returns the object only if it has been modified since the time specified by this header, otherwise 304 Not Modified is returned.

Type: HTTP time string complying with the format specified in http://www.ietf.org/rfc/rfc2616.txt.

Optional

If-Unmodified-Since

Returns the object only if it has not been modified since the time specified by this header, otherwise 412 Precondition Failed is returned.

Type: HTTP time string complying with the format specified in http://www.ietf.org/rfc/rfc2616.txt.

Optional

If-Match

Returns the object only if its ETag is the same as the one specified by this header, otherwise 412 Precondition Failed is returned.

Type: String

Note:

An example ETag value is 0f64741bf7cb1089e988e4585d0d3434.

Optional

If-None-Match

Returns the object only if its ETag is different from the one specified by this header, otherwise 304 Not Modified is returned.

Type: String

Note:

An example ETag value is 0f64741bf7cb1089e988e4585d0d3434.

Optional

Origin

Indicates an origin specified by a pre-request. Generally, it is a domain name.

Type: String

Optional. If you want to obtain the CORs configuration, this item is 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 an encryption 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.

Optional. 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.

Optional. 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 encrypt 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.

Optional. 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.