Interface Specifications
Request Response Format Standard
- Key of the parameter in querystring for the HTTP request is camel case, e.g., upLoadId, partNumber, etc.
- All user-defined Meta are placed in the Header in the form of
x-bce-meta-*
. The total size of the custom meta should not exceed 2K. The Key ofx-bce-meta-*
will be processed by the Server in lowercase.
For example, if the user uploads x-bce-meta-DeMo:value
using the Putobject interface, the Server will uniformly handle it in lowercase x-bce-meta-demo:value
. When the user uses the GetObject interface, the return value of the Sever is x-bce-meta-demo:value
.
- In addition to the standard Header specified in RFC2616, other Headers are defined in the form of
x-bce-*
. - The RESTful API of BOS can be in the JSON format only.
- In all JSON, Key is the camel mode with the first letter lowercased.
- Each request response has
x-bce-request-id
andx-bce-debug-id
headers. - Relevant fields such as Date, Content-MD5, Content-Type, Content-Length in Header comply with RFC 2616.
-
According to the HTTP protocol, Content-MD5 must be MD5 and Base64 encoded. The calculation method is as follows:
Content-MD5 = "Content-MD5" ":" md5-digest md5-digest = <base64 of 128 bit MD5 digest as per RFC 1864>
Common Request Header
Name | Type | Description |
---|---|---|
Authorization | String | The authentication information used to verify the validity of the request. For more details, see Authentication. |
Content-Length | String | The length of the HTTP request content defined in RFC2616 |
Content-Type | String | The type of HTTP request content defined in RFC2616 |
Content-MD5 | String | The MD5 digest of the HTTP request content defined in RFC2616 can be contained to verify whether the file saved in BOS is consistent with the user's expected file. |
Date | String | The GMT time specified in the HTTP 1.1 protocol, e.g., Wed, 06 Apr 2016 06:34:40 GMT . |
Host | String | The access host value, whose value is BucketName.bj.baidubce.com . |
x-bce-date | String | The current time, which conforms to ISO8601 specification, e.g., 2016-04-06T08:23:49Z |
Common Return Header
Name | Type | Description |
---|---|---|
Content-Length | String | The length of the HTTP request content defined in RFC2616 |
Content-Type | String | The type of HTTP request content defined in RFC2616. |
Content-MD5 | String | The MD5 digest of the HTTP request content defined in RFC2616 can be contained to verify whether the file saved in BOS is consistent with the user's expected file. |
Connection | String | Whether to disconnect the server. The value is close or keep-alive . |
Date | String | The GMT time specified in the HTTP 1.1 protocol, such as Wed, 06 Apr 2016 06:34:40 GMT 。 |
eTag | String | The HTTP protocol entity tag of the object. eTag (entity tag) is created when each object is generated to identify the content of an object. The eTag value can be used to check whether the content of an object changes. |
Server | String | The server name, whose value is BceBos . |
x-bce-request-id | String | The unique ID of the request BceBos created by BCE BOS. |
x-bce-debug-id | String | The ID created by BCE BOS to help you perform the troubleshooting. If you encounter any problem during the use of BOS, you can provide this field in the ticket to locate the problem quickly. |
Difference in APIs of Different Storage Types
The storage type of files is implemented based on the object. The infrequent access, cold storage, and archive storage APIs are implemented by adding a storage class attribute to the object. The storage class attribute values are STANDARD, and STANDARD_IA (infrequent access), COLD, and ARCHIVE, which represent the standard storage, infrequent access, cold storage, and archive storage, respectively.
The storage class attribute is added for the following infrequent access/cold storage/archive storage API. The archive storage type does not support AppendObject API:
-
The storage class attribute parameter x-bce-storage-class is set in the request header field for PutObject, InitiateMultipartUpload, CopyObject, AppendObject, and PostObject APIs.
Request header field
Name Type Description Required? x-bce-storage-class String The specified storage type of the BOS object. At present, it can be STANDARD
,STANDARD_IA
,COLD
, orARCHIVE
.No. It is STANDARD
by default. -
GetObject and GetObjectMetareturn x-bce-storage-class in the response header field.
Response Header Field
| Name| Type | Description | | --- | --- | --- | | x-bce-storage-class | String | The storage type of the BOS object. At present, it can be
STANDARD
,STANDARD_IA
,COLD
andARCHIVE
. | Furthermore, when the object is of archive storage type and it is being restored or has been restored, GetObjectMeta returns“x-bce-restore” in the header field, indicating the retrieval state of the object. -
ListObjects, ListMultipartUploads and ListPartsreturn storageClass in the response element.
Response element
Name Type Description storageClass String The storage type of the BOS object. At present, it can be STANDARD
,STANDARD_IA
,COLD
andARCHIVE
.