Updated on 2026-05-26 GMT+08:00

Downloading an Object

Function

This API is used to download an object from OBS to a local directory. For more information, see Downloading an Object.

Working with Other Functions

If the object uploaded to the server is encrypted on the server using the encryption key provided by the client, downloading the object requires including the encryption key in the message.

By default, the GET operation returns the current version of an object. If the current version of the object is a delete marker, OBS returns a code meaning that the object does not exist. To obtain an object of a specified version, the versionId parameter can be used to specify the desired version.

Archive or Deep Archive Objects

If the object you want to download is in the Archive or Deep Archive storage class, ensure that this object has been restored before you download it. The response varies depending on the object's restore state. If an object has been restored, the x-obs-restore header (indicating the expiry date of the object) is returned when the object is successfully downloaded. If you send a request to download Archive or Deep Archive objects that have not been restored or are being restored, a 403 Forbidden error will be returned.

Constraints

Authorization

To call this API, you must be the object owner or have the permissions to download an object. You are advised to use IAM or bucket policies for authorization. For details about OBS authorization methods, see Differences Between OBS Permissions Control Methods.

  • If you use IAM for authorization, you need to use either role/policy-based authorization or identity policy-based authorization and configure the required permissions:
    • If you use role/policy-based authorization (IAM v3 APIs in the old IAM version), you must have the obs:object:GetObject (versioning disabled) and obs:object:GetObjectVersion (versioning enabled or suspended) permissions. For details, see Creating a Custom IAM Policy.
    • If you use identity policy-based authorization (IAM v5 APIs in the new IAM version), you must have the obs:object:getObject (versioning disabled) and obs:object:getObjectVersion (versioning enabled or suspended) permissions, as shown in the following table. For details, see Creating a Custom IAM Identity Policy.

      Action

      Access Level

      Resource Type (*: Required)

      Condition Key

      Alias

      Dependencies

      obs:object:getObject (versioning disabled)

      obs:object:getObjectVersion (versioning enabled or suspended)

      Read

      object *

      -

      • kms:cmk:create
      • kms:cmk:list
      • kms:cmk:decryptDataKey

      -

      • obs:EpochTime
      • obs:SourceIp
      • obs:TlsVersion
      • obs:CustomDomain
  • If you use bucket policies for authorization, you must have the obs:object:GetObject (versioning disabled) and obs:object:GetObjectVersion (versioning enabled or suspended) permissions. For details, see Creating a Custom Bucket Policy.

URI

GET /{object_key}

Calling Method

For details, see Calling APIs. Before calling this API, calculate the API signature and add it to the request.

You can debug this API in API Explorer.

Request Syntax

1
2
3
4
5
6
GET /ObjectName HTTP/1.1 
Host: bucketname.obs.region.myhuaweicloud.com 
Date: date
Authorization: authorization
Range:bytes=byte_range 
<Optional Additional Header>

The Range field is optional. If it is not specified, the entire object is downloaded.

URI Parameters

In a GET request, you can override values for a set of message headers using the request parameters. Message headers that you can override are Content-Type, Content-Language, Expires, Cache-Control, Content-Disposition, and Content-Encoding. If the target object has multiple versions, use the versionId parameter to specify the version to be downloaded. For details, see Table 1.

OBS does not process Accept-Encoding carried in a request or compress or decompress the uploaded data. The client determines whether to compress or decompress the data. Some HTTP clients may decompress data based on the Content-Encoding returned by the server. The client program needs to determine whether to decompress and how to decompress the data. To decompress the data, it can modify Content-Encoding (the object metadata stored in OBS) or rewrite Content-Encoding the object is downloaded. If an object download request specifies the rewrite header, the standard HTTP message header returned by OBS is subject to the rewrite content specified in the request.

Table 1 URI Parameters

Parameter

Type

Mandatory

Description

response-content-type

String

No

Definition

Content-Type is rewritten in the response.

Constraints

This parameter cannot be used by anonymous users. A signature must be included in the request. Otherwise, error 400 ForbidAnonReqOverwriteRespHead will be returned.

Range

See the Content-Type values defined in HTTP.

Default Value

N/A

response-content-language

String

No

Definition

Content-Language is rewritten in the response.

Constraints

This parameter cannot be used by anonymous users. A signature must be included in the request. Otherwise, error 400 ForbidAnonReqOverwriteRespHead will be returned.

Range

See the Content-Language values defined in HTTP.

Default Value

N/A

response-expires

String

No

Definition

Expires is rewritten in the response.

Constraints

This parameter cannot be used by anonymous users. A signature must be included in the request. Otherwise, error 400 ForbidAnonReqOverwriteRespHead will be returned.

Range

See the Expires values defined in HTTP.

Default Value

N/A

response-cache-control

String

No

Definition

Cache-Control is rewritten in the response.

Constraints

This parameter cannot be used by anonymous users. A signature must be included in the request. Otherwise, error 400 ForbidAnonReqOverwriteRespHead will be returned.

Range

See the Cache-control values defined in HTTP.

Default Value

N/A

response-content-disposition

String

No

Definition

Content-Disposition is rewritten in the response.

Example:

response-content-disposition=attachment; filename*=utf-8''name1

In this example, the downloaded object is renamed name1. If the new name contains any full-width characters, such characters must be URL-encoded.

Constraints

This parameter cannot be used by anonymous users. A signature must be included in the request. Otherwise, error 400 ForbidAnonReqOverwriteRespHead will be returned.

Range

N/A

Default Value

N/A

response-content-encoding

String

No

Definition

Content-Encoding is rewritten in the response.

Constraints

This parameter cannot be used by anonymous users. A signature must be included in the request. Otherwise, error 400 ForbidAnonReqOverwriteRespHead will be returned.

Range

See the Content-Encoding values defined in HTTP.

Default Value

N/A

versionId

String

No

Definition

Indicates the version ID of the object to be obtained.

Constraints

N/A

Range

The value must contain 32 characters.

Default Value

N/A. If this parameter is not configured, the latest version of the object is obtained.

x-image-process

String

No

Definition

Image processing command or style.

An example is provided as follows:

Command: x-image-process=image/commands

Style: x-image-process=style/stylename

For details, see the Image Processing Feature Guide.

Constraints

N/A

Range

Command format: image/commands

Style format: style/style-name

Default Value

If no commands are entered, the original image will be returned.

attname

String

No

Definition

Content-Disposition is rewritten in the response.

Example:

attname=name1

This example renames the downloaded object as name1.

Constraints

N/A

Range

N/A

Default Value

N/A

Request Headers

This request uses common headers. In addition, you can add additional headers to this request. Table 2 describes the additional headers.

Table 2 Request headers

Header

Type

Mandatory

Description

Range

String

No

Definition

Obtains the object content within the scope defined by Range.

Constraints

  • Range can be set to any of the following formats:

    bytes=Start value-End value: The range starts from the start value and ends at the end value.

    bytes=Start value-: The range starts from the start value and ends at (object length – 1).

    bytes=-End value: The range starts from (object length – end value) and ends at (object length – 1).

    If Range is not set in any of these formats, the Range field is ignored and the entire object is returned.

    Example 1: bytes=0-4 (Downloads data from the first byte to the fifth byte.)

    Example 2: bytes=4- (Downloads data from the fifth byte to the end.)

    Example 3: bytes=-4 (Downloads data of the last four bytes.)

    Example 4: bytes=10-20,30-40 (indicating multiple ranges)

  • After the Range header field is carried, the value of ETag in the response message is the ETag of the object instead of the ETag of the object in the Range field.
  • When you download the object content in a single range, the length of the range cannot exceed the length of the object content. When you download the object content in multiple ranges, the total length of all ranges cannot exceed the total length of the object content.

Range

  • The start value ranges from 0 to the object length minus 1.

    If the start value is less than 0, the Range field is ignored and the entire object is returned.

    If the start value is greater than the object length minus 1, an error is reported, with 416 (InvalidRange) returned.

  • The end value must be greater than the start value.

    If the end value is not greater than the start value, the Range field is ignored and the entire object is returned

    If the end value is greater than the object length minus 1, the system automatically corrects the end value to the object length minus 1.

Default Value

N/A

If-Modified-Since

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

No

Definition

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

Constraints

The time specified by this parameter cannot be later than the current server time (GMT time), or this parameter does not take effect.

Range

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

  1. EEE, dd MMM yyyy HH:mm:ss z
  2. EEEE, dd-MMM-yy HH:mm:ss z
  3. EEE MMM dd HH:mm:ss yyyy

Examples:

  1. if-modified-since: Sun, 06 Nov 1994 08:49:37 GMT
  2. if-modified-since: Sunday, 06-Nov-94 08:49:37 GMT
  3. if-modified-since: Sun Nov 6 08:49:37 1994

Default Value

N/A

If-Unmodified-Since

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

No

Definition

If the object has not been modified since the time specified by this header, it is returned. Otherwise, 412 (precondition failed) is returned.

Constraints

The time specified by this parameter cannot be later than the current server time (GMT time), or this parameter does not take effect.

Range

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

  1. EEE, dd MMM yyyy HH:mm:ss z
  2. EEEE, dd-MMM-yy HH:mm:ss z
  3. EEE MMM dd HH:mm:ss yyyy

Examples:

  1. if-unmodified-since: Sun, 06 Nov 1994 08:49:37 GMT
  2. if-unmodified-since: Sunday, 06-Nov-94 08:49:37 GMT
  3. if-unmodified-since: Sun Nov 6 08:49:37 1994

Default Value

N/A

If-Match

String

No

Definition

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

ETag example: 0f64741bf7cb1089e988e4585d0d3434

Constraints

N/A

Range

Object ETag

Default Value

N/A

If-None-Match

String

No

Definition

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

ETag example: 0f64741bf7cb1089e988e4585d0d3434

Constraints

N/A

Range

Object ETag

Default Value

N/A

x-obs-server-side-encryption-customer-algorithm

String

No. This header is required when SSE-C is used.

Definition

Indicates the encryption algorithm used when SSE-C is used.

Example: x-obs-server-side-encryption-customer-algorithm:AES256

Constraints:

This header must be used together with x-obs-server-side-encryption-customer-key and x-obs-server-side-encryption-customer-key-MD5.

Range

AES256

Default Value

N/A

x-obs-server-side-encryption-customer-key

String

No. This header is required when SSE-C is used.

Definition

Indicates the encryption key used when SSE-C is used. This key is used to decrypt objects.

Example: x-obs-server-side-encryption-customer-key:K7QkYpBkM5+hca27fsNkUnNVaobncnLht/rCB2o/9Cw=

Constraints

This header is a Base64-encoded 256-bit key and must be used together with x-obs-server-side-encryption-customer-algorithm and x-obs-server-side-encryption-customer-key-MD5.

Range

N/A

Default Value

N/A

x-obs-server-side-encryption-customer-key-MD5

String

No. This header is required when SSE-C is used.

Definition

Indicates the MD5 value of the encryption key when SSE-C is used. The MD5 value is used to check whether any error occurs during the transmission of the key.

Example: x-obs-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-obs-server-side-encryption-customer-algorithm and x-obs-server-side-encryption-customer-key.

Range

Base64-encoded MD5 value of the key ID.

Default Value

N/A

Request Body

This request contains no request body parameters.

Response Syntax

1
2
3
4
5
6
7
8
HTTP/1.1 status_code 
Content-Type: type 
Date: date 
Content-Length: length 
Etag: etag 
Last-Modified: time 

<Object Content>

Response Headers

This response uses common headers. For details, see Table 1.

In addition to the common response headers, the headers listed in Table 3 may be used.

Table 3 Response headers

Header

Type

Description

x-obs-expiration

String

Definition

Expiration time of an object.

Constraints

When an object has its lifecycle rule, the object expiration time is subject to its lifecycle rule. This header uses expiry-date to describe the object expiration date. If the lifecycle rule is configured only for the entire bucket but not for individual objects, the object expiration time is subject to the bucket lifecycle rule. This header uses expiry-date and rule-id to describe the detailed expiration information of objects. If no lifecycle rule is configured, this header is not contained in the response.

Range

The time format is EEE, dd MMM yyyy HH:mm:ss z.

Example: expiry-date=Sun, 06 Nov 1994 08:49:37 GMT

Default Value

N/A

x-obs-website-redirect-location

String

Definition

Indicates where an object request is redirected. If the bucket that contains the object is configured with Website settings, this parameter can be set in the object metadata so that the request for the object can be redirected to another object in the same bucket or an external URL after the website returns a 301 redirect response.

To another object in the same bucket:

x-obs-website-redirect-location:/anotherPage.html

To an external URL:

x-obs-website-redirect-location:http://www.example.com/

OBS obtains the specified value from the header and stores it in the object metadata WebsiteRedirectLocation.

Constraints

  • The value must start with a slash (/), http://, or https:// and cannot exceed 2 KB.
  • OBS supports redirection for objects in the root directory of a bucket, not for those in folders.

Default Value

N/A

x-obs-delete-marker

Boolean

Definition

Whether the deleted object is a delete marker. If the object is not marked as deleted, the response does not contain this header.

Range

  • true: The deleted object is a delete marker.
  • false: The deleted object is not a delete marker.

Default Value

false

x-obs-version-id

String

Definition

Object version ID.

Constraints

If the object has no version number specified, the response does not contain this header.

Range

The value must contain 32 characters.

Default Value

N/A

x-obs-server-side-encryption

String

Definition

The server-side encryption method. Example: x-obs-server-side-encryption:kms

Constraints

N/A

Range

  • kms: SSE-KMS is used for encryption.
  • AES256: SSE-OBS and the AES256 algorithm are used.

Default Value

N/A

x-obs-server-side-encryption-kms-key-id

String

Definition

ID of a specified key used for SSE-KMS encryption. For details about how to obtain a key ID, see Viewing a Key.

Constraints

This header can only be used when you specify kms for the x-obs-server-side-encryption header.

Default Value

If you specify kms for encryption but do not specify a key ID, the default master key will be used. If there is no default master key, OBS will create one and use it.

x-obs-server-side-encryption-customer-algorithm

String

Definition

Indicates a decryption algorithm. This header is included in a response if SSE-C is used.

Example: x-obs-server-side-encryption-customer-algorithm:AES256

Constraints

N/A

Range

AES256

Default Value

N/A

x-obs-server-side-encryption-customer-key-MD5

String

Definition

Indicates the MD5 value of a key used to decrypt objects. This header is included in a response if SSE-C is used.

Example: x-obs-server-side-encryption-customer-key-MD5:4XvB3tbNTN+tIEVa0/fGaQ==

Range

Base64-encoded MD5 value of the key ID.

Default Value

N/A

x-obs-object-type

String

Definition

Object type

Constraints

This header is returned when the object is not a Normal object.

Range

  • Appendable: objects generated by appending

Default Value

N/A

x-obs-next-append-position

Integer

Definition

Indicates the position that should be provided in the next request.

Constraints

This header field is returned when the object is an appendable object.

Range

N/A

Default Value

N/A

x-obs-tagging-count

String

Definition

Number of tags associated with an object.

Example: x-obs-tagging-count:1

Constraints

This parameter is returned only when the user has the permission to read tags.

Range

N/A

Default Value

N/A

Response Body

This response contains no elements.

Error Responses

No special errors. You can find all errors in Table 2.

Sample Request: Downloading an Object

1
2
3
4
5
6
GET /object01 HTTP/1.1
User-Agent: curl/7.29.0
Host: examplebucket.obs.region.myhuaweicloud.com
Accept: */*
Date: WED, 01 Jul 2015 04:24:33 GMT
Authorization: OBS H4IPJX0TQTHTHEBQQCEC:NxtSMS0jaVxlLnxlO9awaMTn47s=

Sample Response: Downloading an Object

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
HTTP/1.1 200 OK
Server: OBS
x-obs-request-id: 8DF400000163D3F2A89604C49ABEE55E
Accept-Ranges: bytes
ETag: "3b46eaf02d3b6b1206078bb86a7b7013"
Last-Modified: WED, 01 Jul 2015 01:20:29 GMT
Content-Type: binary/octet-stream
x-obs-id-2: 32AAAQAAEAABAAAQAAEAABAAAQAAEAABCSQwxJ2I1VvxD/Xgwuw2G2RQax30gdXU
Date: WED, 01 Jul 2015 04:24:33 GMT
Content-Length: 4572

[4572 Bytes object content]

Sample Request: Downloading a Specified Range of an Object

Download the specified range of an object (download a range of an object).

1
2
3
4
5
6
7
GET /object01 HTTP/1.1
User-Agent: curl/7.29.0
Host: examplebucket.obs.region.myhuaweicloud.com
Accept: */*
Date: Mon, 14 Sep 2020 09:59:04 GMT
Range:bytes=20-30
Authorization: OBS H4IPJX0TQTHTHEBQQCEC:mNPLWQMDWg30PTkAWiqJaLl3ALg=

Download the specified range of an object (download multiple ranges of an object).

The total length of all ranges cannot exceed the total length of the object content.

1
2
3
4
5
6
7
GET /object01 HTTP/1.1
User-Agent: curl/7.29.0
Host: examplebucket.obs.region.myhuaweicloud.com
Accept: */*
Date: Mon, 14 Sep 2020 10:02:43 GMT
Range:bytes=20-30,40-50
Authorization: OBS H4IPJX0TQTHTHEBQQCEC:ZwM7Vk2d7sD9o8zRsRKehgKQDkk=

Sample Response: Downloading a Specified Range of an Object

Download the specified range of an object (download a range of an object).

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
HTTP/1.1 206 Partial Content
Server: OBS
x-obs-request-id: 000001748C0DBC35802E360C9E869F31
Accept-Ranges: bytes
ETag: "2200446c2082f27ed2a569601ca4e360"
Last-Modified: Mon, 14 Sep 2020 01:16:20 GMT
Content-Range: bytes 20-30/4583
Content-Type: binary/octet-stream
x-obs-id-2: 32AAAQAAEAABAAAQAAEAABAAAQAAEAABCSn2JHu4okx9NBRNZAvBGawa3lt3g31g
Date: Mon, 14 Sep 2020 09:59:04 GMT
Content-Length: 11

[ 11 Bytes object content]

Download the specified range of an object (download multiple ranges of an object).

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
HTTP/1.1 206 Partial Content
Server: OBS
x-obs-request-id: 8DF400000163D3F2A89604C49ABEE55E
Accept-Ranges: bytes
ETag: "2200446c2082f27ed2a569601ca4e360"
Last-Modified: Mon, 14 Sep 2020 01:16:20 GMT
Content-Type: multipart/byteranges;boundary=35bcf444-e65f-4c76-9430-7e4a68dd3d26
x-obs-id-2: 32AAAQAAEAABAAAQAAEAABAAAQAAEAABCSIBWFOVW8eeWujkqSnoIANC2mNR1cdF
Date: Mon, 14 Sep 2020 10:02:43 GMT
Content-Length: 288

--35bcf444-e65f-4c76-9430-7e4a68dd3d26
Content-type: binary/octet-stream
Content-range: bytes 20-30/4583
[ 11 Bytes object content]
--35bcf444-e65f-4c76-9430-7e4a68dd3d26
Content-type: binary/octet-stream
Content-range: bytes 40-50/4583
[ 11 Bytes object content]
--35bcf444-e65f-4c76-9430-7e4a68dd3d26

Sample Request: Downloading a Resized Image

1
2
3
4
5
6
GET /example.jpg?x-image-process=image/resize,w_100 HTTP/1.1
User-Agent: curl/7.29.0
Host: examplebucket.obs.region.myhuaweicloud.com
Accept: */*
Date: WED, 01 Jul 2015 04:20:51 GMT
Authorization: OBS H4IPJX0TQTHTHEBQQCEC:9Nsx45WjaVxlLnxlO9awasXn83N=

Sample Response: Downloading a Resized Image

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
HTTP/1.1 200 OK
Server: OBS
x-obs-request-id: 8DF400000163D3F2A89604C49ABEE55E
x-image-process:image/resize,w_100
Accept-Ranges: bytes
ETag: "3b46eaf02d3b6b1206078bb86a7b7013"
Last-Modified: WED, 01 Jul 2015 01:20:29 GMT
Content-Type: image/jpeg
x-obs-id-2: 32AAAQAAEAABAAAQAAEAABAAAQAAEAABCSQwxJ2I1VvxD/Xgwuw2G2RQax30gdXU
Date: WED, 01 Jul 2015 04:20:51 GMT
Content-Length: 49

[ 49 Bytes object content]

Sample Request: Checking the ETag Value of an Object

Download an object if its ETag value is matched.

1
2
3
4
5
6
7
GET /object01 HTTP/1.1
User-Agent: curl/7.29.0
Host: examplebucket.obs.region.myhuaweicloud.com
Accept: */*
Date: WED, 01 Jul 2015 04:24:33 GMT
If-Match: 682e760adb130c60c120da3e333a8b09
Authorization: OBS H4IPJX0TQTHTHEBQQCEC:NxtSMS0jaVxlLnxlO9awaMTn47s=

Sample Response: Checking the ETag Value of an Object (ETag Mismatch)

If the object's ETag value is not 682e760adb130c60c120da3e333a8b09, the system displays a download failure message.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
HTTP/1.1 412 Precondition Failed
Server: OBS
x-obs-request-id: 8DF400000163D3F2A89604C49ABEE55E
Content-Type: application/xml
x-obs-id-2: 32AAAQAAEAABAAAQAAEAABAAAQAAEAABCSQwxJ2I1VvxD/Xgwuw2G2RQax30gdXU
Date: WED, 01 Jul 2015 04:20:51 GMT

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Error>
  <Code>PreconditionFailed</Code>
  <Message>At least one of the pre-conditions you specified did not hold</Message> 
  <RequestId>8DF400000163D3F2A89604C49ABEE55E</RequestId>      
  <HostId>ha0ZGaSKVm+uLOrCXXtx4Qn1aLzvoeblctVXRAqA7pty10mzUUW/yOzFue04lBqu</HostId>
  <Condition>If-Match</Condition>
</Error>

Sample Response: Checking the ETag Value of an Object (ETag Matched)

If the object's ETag value is 682e760adb130c60c120da3e333a8b09, the download is successful.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
HTTP/1.1 200 OK
Server: OBS
x-obs-request-id: 5DEB00000164A21E1FC826C58F6BA001
Accept-Ranges: bytes
ETag: "682e760adb130c60c120da3e333a8b09"
Last-Modified: Mon, 16 Jul 2015 08:03:34 GMT
Content-Type: application/octet-stream
x-obs-id-2: 32AAAQAAEAABAAAQAAEAABAAAQAAEAABCSbkdml1sLSvKnoHaRcOwRI+6+ustDwk
Date: Mon, 16 Jul 2015 08:04:00 GMT
Content-Length: 8

[ 8 Bytes object content]

Sample Request: Downloading an Object Using a Signed URL

GET /object02?AccessKeyId=H4IPJX0TQTHTHEBQQCEC&Expires=1532688887&Signature=EQmDuOhaLUrzrzRNZxwS72CXeXM%3D HTTP/1.1
User-Agent: curl/7.29.0
Host: examplebucket.obs.region.myhuaweicloud.com
Accept: */*
Date: Fri, 27 Jul 2018 10:52:31 GMT

Sample Response: Downloading an Object Using a Signed URL

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
HTTP/1.1 200 OK
Server: OBS
x-obs-request-id: 804F00000164DB5E5B7FB908D3BA8E00
ETag: "682e760adb130c60c120da3e333a8b09"
Last-Modified: Mon, 16 Jul 2015 08:03:34 GMT
Content-Type: application/octet-stream
x-obs-id-2: 32AAAUJAIAABAAAQAAEAABAAAQAAEAABCTlpxILjhVK/heKOWIP8Wn2IWmQoerfw
Date: Fri, 27 Jul 2018 10:52:31 GMT
Content-Length: 8

[ 8 Bytes object content]

Sample Request: Downloading an Object and Renaming It (with response-content-disposition Used)

Use the response-content-disposition parameter to download and rename an object.

1
2
3
4
5
6
GET /object01?response-content-disposition=attachment; filename*=utf-8''name1 HTTP/1.1
User-Agent: curl/7.29.0
Host: examplebucket.obs.region.myhuaweicloud.com
Accept: */*
Date: WED, 01 Jul 2015 04:24:33 GMT
Authorization: OBS H4IPJX0TQTHTHEBQQCEC:NxtSMS0jaVxlLnxlO9awaMTn47s=

Sample Response: Downloading an Object and Renaming It (with response-content-disposition Used)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
HTTP/1.1 200 OK
Server: OBS
x-obs-request-id: 804F00000164DB5E5B7FB908D3BA8E00
ETag: "682e760adb130c60c120da3e333a8b09"
Last-Modified: Mon, 16 Jul 2015 08:03:34 GMT
Content-Type: application/octet-stream
x-obs-id-2: 32AAAUJAIAABAAAQAAEAABAAAQAAEAABCTlpxILjhVK/heKOWIP8Wn2IWmQoerfw
Date: Fri, 27 Jul 2018 10:52:31 GMT
Content-Length: 8
Content-Disposition: attachment; filename*=utf-8''name1

[ 8 Bytes object content]

Sample Request: Downloading an Object and Renaming It (with attname Used)

Use the attname parameter to download and rename an object.

1
2
3
4
5
6
GET /object01?attname=name1 HTTP/1.1
User-Agent: curl/7.29.0
Host: examplebucket.obs.region.myhuaweicloud.com
Accept: */*
Date: WED, 01 Jul 2015 04:24:33 GMT
Authorization: OBS H4IPJX0TQTHTHEBQQCEC:NxtSMS0jaVxlLnxlO9awaMTn47s=

Sample Response: Downloading an Object and Renaming It (with attname Used)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
HTTP/1.1 200 OK
Server: OBS
x-obs-request-id: 804F00000164DB5E5B7FB908D3BA8E00
ETag: "682e760adb130c60c120da3e333a8b09"
Last-Modified: Mon, 16 Jul 2015 08:03:34 GMT
Content-Type: application/octet-stream
x-obs-id-2: 32AAAUJAIAABAAAQAAEAABAAAQAAEAABCTlpxILjhVK/heKOWIP8Wn2IWmQoerfw
Date: Fri, 27 Jul 2018 10:52:31 GMT
Content-Length: 8
Content-Disposition: attachment; filename*=utf-8''name1

[ 8 Bytes object content]

Sample Request: Sending a Request That Includes Custom Response Headers

GET /obj001?response-expires=Thu%2C%2001%20Feb%202015%2017%3A00%3A00%20GMT HTTP/1.1
User-Agent: curl/7.29.0
Host: examplebucket.obs.region.myhuaweicloud.com
Accept: */*
Date: WED, 01 Jul 2015 02:37:22 GMT
Authorization: OBS UDSIAMSTUBTEST000003:2tod8LyZOGA0+46HMjmp176XRaI=

Sample Response: Sending a Request That Includes Custom Response Headers

Server: OBS
x-obs-id-2: 32AAAQAAEAABSAAgAAEAABAAAQAAEAABCSmpL2dv6zZLM2HmUrXKTAi258MPqmrp
x-obs-request-id: 0000018A2A73AF59D3085C8F8ABF0C65
Accept-Ranges: bytes
ETag: "21e7e5efb6b73de19e691d6c4e32a9cf"
Content-Disposition: attachment
Date: WED, 01 Jul 2015 02:37:22 GMT
Expires: Thu, 01 Feb 2015 17:00:00 GMT
Content-Type: binary/octet-stream
Content-Length: 392
 
[392 Bytes object content]

Sample Request: Specifying a Version ID to Download a Specific Object Version

GET /obj001?versionId=G001118A6803675AFFFFD3043F7F91D0 HTTP/1.1
User-Agent: curl/7.29.0
Host: examplebucket.obs.region.myhuaweicloud.com
Accept: */*
Date: WED, 01 Jul 2015 02:37:22 GMT
Authorization: OBS UDSIAMSTUBTEST000003:2tod8LyZOGA0+46HMjmp176XRaI=

Sample Response: Specifying a Version ID to Download a Specific Object Version

Server: OBS
x-obs-id-2: 32AAAQAAEAABSAAgAAEAABAAAQAAEAABCSmpL2dv6zZLM2HmUrXKTAi258MPqmrp
x-obs-request-id: 0000018A2A73AF59D3085C8F8ABF0C65
Accept-Ranges: bytes
x-obs-version-id: G001118A6803675AFFFFD3043F7F91D0
ETag: "21e7e5efb6b73de19e691d6c4e32a9cf"
Content-Disposition: attachment
Date: WED, 01 Jul 2015 02:37:22 GMT
Content-Type: binary/octet-stream
Content-Length: 392
 
[392 Bytes object content]

Sample Request: Downloading an Object Stored Using Server-Side Encryption

GET /obj001 HTTP/1.1
User-Agent: curl/7.29.0
Host: examplebucket.obs.region.myhuaweicloud.com
Accept: */*
Date: WED, 01 Jul 2015 02:37:22 GMT
Authorization: OBS UDSIAMSTUBTEST000003:2tod8LyZOGA0+46HMjmp176XRaI=
x-obs-server-side-encryption-customer-key:d09s2lKS9cmQO9135fQXMCV8fsOP02aDWd441g
x-obs-server-side-encryption-customer-key-MD5:ZjQpad35Fiw1322Fwa
x-obs-server-side-encryption-customer-algorithm:AES256

Sample Response: Downloading an Object Stored Using Server-Side Encryption

Server: OBS
x-obs-id-2: 32AAAQAAEAABSAAgAAEAABAAAQAAEAABCSmpL2dv6zZLM2HmUrXKTAi258MPqmrp
x-obs-request-id: 0000018A2A73AF59D3085C8F8ABF0C65
Accept-Ranges: bytes
ETag: "21e7e5efb6b73de19e691d6c4e32a9cf"
Content-Disposition: attachment
Date: WED, 01 Jul 2015 02:37:22 GMT
Content-Type: binary/octet-stream
Content-Length: 392
x-obs-server-side-encryption-customer-key-MD5:ZjQpad35Fiw1322Fwa
x-obs-server-side-encryption-customer-algorithm:AES256
 
[392 Bytes object content]

Using SDKs to Call APIs

You are advised to use OBS SDKs to call APIs. SDKs encapsulate APIs to simplify development. You can call SDK API functions to access OBS without manually calculating signatures.

Helpful Links