GetObject
Updated at:2025-11-03
API description
This command retrieves an object from BOS. The requester must have read permission for the object. You can specify the range of the object's data to retrieve by setting the range in the header.
Request
-
Request syntax
Plain Text1GET /<ObjectKey> HTTP/1.1 2Host: <BucketName>.bj.bcebos.com 3Date: <Date> 4Authorization: <AuthorizationString> 5Range: <Range_String> -
Multi-version request syntax
Plain Text1GET /<ObjectKey>?versionId=<VersionId> HTTP/1.1 2Host: <BucketName>.bj.bcebos.com 3Date: <Date> 4Authorization: <AuthorizationString> 5Range: <Range_String> -
Request headers
| Name | Types | Description | Whether required |
|---|---|---|---|
| Range | String | Specify the file range to be returned by the object. For example, set bytes=0-9 to transmit 10 characters from positions 0 to 9. By default, all data is returned. | No |
| Field | Types | Whether required | Description |
|---|---|---|---|
| versionId | String | No | Retrieve the version ID of object. Retrieve the latest version if it is null by default; Retrieve the information of the null version if it is specified as "null". |
Response
| Name | Types | Description |
|---|---|---|
| Cache-Control | String | Cache settings for downloading the Object. Common values include private, no-cache, max-age and must-revalidate |
| Content-Disposition | String | Set whether to download the browser. Options: inline, attachment; filename="download.txt" |
| Content-Length | Long Int | Size of data returned to the object |
| Content-Range | String | Range of data returned to the object when the range is set up |
| Content-Type | String | Object type and encoding method |
| Expires | String | Cache expiration time when the object is downloaded |
| ETag | String | The HTTP protocol entity tag of object |
| x-bce-meta-* | String | This item is returned only if custom meta exists |
| x-bce-storage-class | String | Return STANDARD for standard storage, STANDARD_IA for infrequent access storage, COLD for cold storage, and ARCHIVE for archive storage; if it is multi-AZ bucket, return MAZ_STANDARD_IA for multi-AZ infrequent access storage, and MAZ_STANDARD for multi-AZ standard storage. |
| x-bce-server-side-encryption | String | The server-side encryption type for the object supports AES256 and SM4 encryption. |
| x-bce-content-crc32 | String | Returns the CRC32 of the object. |
| x-bce-version-id | String | Returns the version ID of the object. |
Plain Text
1> **Note**
2>
3> - GetObject supports resumable uploads based on the range parameter. This feature is recommended for larger objects.
4> - If the Range parameter is included in the request header, the response will contain the total file length and the returned range. For example, Content-Range: bytes 0-9/44 indicates the file's total length is 44 and the returned range is 0-9.
5> - Attempting to read a 0-byte object with the Range parameter will result in a 400 error. The Range is a closed interval at both ends.
6> - Objects stored in the archive class must be restored before invoking the GetObject API.
7
8If you want to obtain specific header information in the response request, the following two methods are available:
9
10- Add header information during PutObject operation for direct returning in the response during GetObject operation. Please refer to [PutObject API](#PutObject API).
11
12 > **Note:** responseContentDisposition setting has domain name in BOS ($region.bcebos.com and *.$region.bcebos.com are invalid).
13
14- During the GetObject operation, include "responseXXX=YYY" in the queryString to add "XXX: YYY" to the response header. For example, GET /testBucket/testObject?responseContentType=image/jpg will include "Content-Type: image/jpg" in the HTTP response.
15
16 The specific format is **response$header=urlencode(value)**. It should be noted that the current $header only supports "ContentDisposition, ContentType, ContentLanguage, Expires, CacheControl and ContentEncoding".
Example
-
Request example
Plain Text1GET /ObjectName 2Host: BucketName.bj.bcebos.com 3Date: Wed, 06 Apr 2016 06:34:40 GMT 4Authorization: AuthorizationString 5Range: bytes=0-9 -
Response example
Plain Text1HTTP/1.1 206 Partial Content 2x-bce-request-id: 4db2b34d-654d-4d8a-b49b-3049ca786409 3x-bce-storage-class: STANDARD 4Date: Wed, 06 Apr 2016 06:34:40 GMT 5Last-Modified: Fri, 28 Jan 2011 20:10:32 GMT 6ETag: "b2419b1e3fd45d596ee22bdf62aaaa2f" 7Accept-Ranges: bytes 8Content-Range: bytes 0-9/443 9Content-Type: text/plain 10Content-Length: 10 11Server: BceBos 12[10 bytes of object data] -
Multi-version request example
Plain Text1GET /ObjectName?versionId=ADCQMlGFiNo%3D 2Host: BucketName.bj.bcebos.com 3Date: Wed, 06 Apr 2016 06:34:40 GMT 4Authorization: AuthorizationString 5Range: bytes=0-9 -
Response example
Plain Text1HTTP/1.1 206 2x-bce-request-id: ffaa6a28-1d13-44dd-9266-6ae6181cffdc 3x-bce-storage-class: STANDARD 4Date: Wed, 06 Apr 2016 06:34:40 GMT 5Last-Modified: Fri, 28 Jan 2011 20:10:32 GMT 6ETag: "b2419b1e3fd45d596ee22bdf62aaaa2f" 7Accept-Ranges: bytes 8Content-Range: bytes 0-9/443 9Content-Type: text/plain 10Content-Length: 10 11x-bce-version-id:ADCQMlGFiNo= 12Server: BceBos 13[10 bytes of object data]
