1. Authentication
There are two possible options for the authentication: Basic Authentication with username and password or Signature Verification for improved security.
1.1. Basic Authentication
Basic Authentication requires your username and password, which are sent as a Base64 encoded string in the Authorization header.
Example 1
curl -u <username>:<password> https://<s3.webercloud-china.cn>/<bucket>/
Example 2
curl -X GET \ https://<s3.webercloud-china.cn>/<bucket>/ \ -H "Authorization: Basic <Base64(username:password)>"
1.2. Signature Verification
In addition to your username and password, the Signature Verification also includes the HTTP method, the URI, the date and optionally the content of the file. Signature Verification provides better security, but a new signature needs to be calculated for each request.
A signature can be calculated in the following way:
Base64(HMAC-SHA1(<password>,<method>&<uri>&<date>&<content-md5>))
Related parameter description
- Password: The password related to your username.
- Method: The corresponding HTTP method, such as GET, POST, PUT and HEAD.
- URI: The request path in the format /bucket/URI.
- Date: Request date and time, such as Wed, 22 Apr 2020 02:26:58 GMT or 2020-04-22 10:26:58.
- Content-MD5 (optional): MD5 value of the request body. If the file is too large to calculate MD5 or the request body is empty, it can be empty.
Additional notes
- MD5 hashes should be encoded as 32 lowercase hexadecimal digits.
- The output of HMAC-SHA1 must be raw binary data.
- Date is used to verify whether the signature is valid. The validity period of a signature is 30 minutes.
Example
curl -X PUT \ https://<s3.webercloud-china.cn>/<bucket>/<image.jpg> \ -H "Authorization: WESTYUN <username>:<signature>" \ -H "Content-MD5: <7ac66c0f148de9519b8bd264312c4d64>" \ -H "Date: <2020-04-23 16:24:46>" \ -H "Content-Type: <image/jpeg>" \ -H "Content-Length: <33456>"
2. REST API
2.1. Upload files
PUT /<bucket>/<path_to_file>
Request headers
| Header |
Required |
Type |
Explanation |
| Content-Length |
Yes |
Integer |
Request content length |
| Content-MD5 |
No |
String |
MD5 value of the uploaded file. If the file in the request is too large to calculate MD5, it can be left blank. |
| Content-Type |
No |
String |
File mime type. By default, a common mime type will be used according to the file extension. |
| Content-Secret |
No |
String |
File key, which is used to protect files and prevent them from being directly accessed. See the Content-Secret parameter description. |
| x-west-meta-ttl |
No |
Integer |
Specify the file's lifetime in days, up to 180 days, see Metadata |
| x-west-meta-XYZ |
No |
String |
Other file metadata, see Metadata |
| x-west-overwrite |
No |
Boolean |
Overwrite existing files when uploading files. The default value is false. |
| x-west-automkdir |
No |
Boolean |
If the path to the file includes directories, which do not exist yet, they will be created automatically. The default value is false. |
| x-west-async |
No |
Boolean |
Asynchronous processing of the request. Default value is false. |
Additional notes
- The maximum supported single-thread file upload size is 1 GB. For files larger than 1 GB, you need to upload the file in chunks. It is generally recommended to upload the file in chunks if it is larger than 100 MB.
- Storing a large number of files in the same directory at the same time may affect performance, so it is recommended that when there are too many files, they are stored in different subdirectories.
Content-Secret parameter
If a content secret is set for a file, it cannot be accessed directly anymore. Any requests to the file need to include the content secret, which needs to be added at the end of the URL, separated with "!". Example: https://<s3.webercloud-china.cn>/<bucket>/<path_to_secret_file>!<content-secret>
To delete or modify a content-secret, see Metadata.
Response
- Upon success, the status code 200 will be returned.
- If failed, an error message will be returned. Please refer to the API Error Code Table for details.
2.2. Upload files in chunks
PUT /<bucket>/<path_to_file>
Initialization request headers
| Header |
Required |
Type |
Explanation |
| x-west-multi-disorder |
Yes |
Boolean |
The value must be true in order to indicate that the upload is performed in chunks. |
| x-west-multi-stage |
Yes |
String |
The value must be "initiate" in order to initialize the upload. |
| x-west-multi-length |
Yes |
Integer |
The total size of the file in bytes. |
| x-west-multi-type |
No |
String |
File mime type. By default, a common mime type will be used according to the file extension. |
| x-west-meta-ttl |
No |
String |
Specify the file's lifetime in days, up to 180 days, Metadata |
| x-west-meta-XYZ |
No |
String |
Other file metadata, see Metadata |
| x-west-overwrite |
No |
Boolean |
Overwrite existing files when uploading files. The default value is false. |
| x-west-automkdir |
No |
Boolean |
If the path to the file includes directories, which do not exist yet, they will be created automatically. The default value is false. |
Chunk upload request headers
| Header |
Required |
Type |
Explanation |
| x-west-multi-disorder |
Yes |
Boolean |
The value must be true in order to indicate that the upload is performed in chunks. |
| x-west-multi-stage |
Yes |
String |
The value "upload" is required for uploads of chunks. |
| x-west-part-id |
Yes |
Integer |
The serial number of the chunk, starting from 0. |
| Content-Length |
No |
String |
Request content length |
| Content-MD5 |
No |
String |
MD5 value of the uploaded file |
Finalize upload request headers
| Header |
Required |
Type |
Explanation |
| x-west-multi-disorder |
Yes |
Boolean |
The value must be true in order to indicate that the upload is performed in chunks. |
| x-west-multi-stage |
Yes |
String |
The value "complete" is required to finalize the upload process. |
Additional notes
- The maximum supported file size is 13 TB.
- Except for the last chunk, all chunks need to have a size of exactly 1 MB.
- In order to upload a file in chunks, the upload needs to be initialized first.
- After initialization is completed, blocks can be uploaded in parallel.
- Once all chunks have been uploaded, the upload needs to be finalized.
- The file will not be available on the bucket before all chunks have been uploaded, or if the upload is never finalized.
Response
- Upon success, the status code 200 will be returned.
- If failed, an error message will be returned. Please refer to the API Error Code Table for details.
Example
Initialization:
curl -X PUT \ http://<s3.webercloud-china.cn>/<bucket>/<image.jpg> \ -H "x-west-multi-disorder:true" \ -H "x-west-multi-stage:initiate" \ -H "x-west-multi-length:<2097162>" \ -H "x-west-multi-type:<image/jpg>" \ -H "Authorization: Basic <Base64(username:password)>"
Upload of chunks:
curl -X PUT \ http://<s3.webercloud-china.cn>/<bucket>/<image.jpg> \ -H "x-west-multi-disorder:true" \ -H "x-west-multi-stage:upload" \ -H "x-west-part-id:0" \ -H "Authorization: Basic <Base64(username:password)>" -d <1 MB payload>
curl -X PUT \ http://<s3.webercloud-china.cn>/<bucket>/<image.jpg> \ -H "x-west-multi-disorder:true" \ -H "x-west-multi-stage:upload" \ -H "x-west-part-id:1" \ -H "Authorization: Basic <Base64(username:password)>" -d <1 MB payload>
curl -X PUT \ http://<s3.webercloud-china.cn>/<bucket>/<image.jpg> \ -H "x-west-multi-disorder:true" \ -H "x-west-multi-stage:upload" \ -H "x-west-part-id:2" \ -H "Authorization: Basic <Base64(username:password)>" -d <remaining payload>
Finalize upload:
curl -X PUT \ http://<s3.webercloud-china.cn>/<bucket>/<image.jpg> \ -H "x-west-multi-disorder:true" \ -H "x-west-multi-stage:complete" \ -H "Authorization: Basic <Base64(username:password)>"
2.3. Copy files
PUT /<bucket>/<new_path_to_file>
Request headers
| Header |
Required |
Type |
Explanation |
| x-west-copy-source |
Yes |
String |
Path of the original file, in the format /<bucket>/<path_to_original_file> |
| x-west-meta-directive |
No |
String |
The operation mode of x-west-metadata-x is: copy (default), merge, replace, delete. For the specific meaning of each value, see description of option parameter under Metadata |
| x-west-meta-XYZ |
No |
String |
Other file metadata, see Metadata |
| x-west-automkdir |
No |
Boolean |
If the path to the file includes directories, which do not exist yet, they will be created automatically. The default value is false. |
Additional notes
- You can only copy files within the same bucket.
- Directories cannot be copied.
Response
- Upon success, the status code 200 will be returned.
- If failed, an error message will be returned. Please refer to the API Error Code Table for details.
2.4. Move files
PUT /<bucket>/<new_path_to_file>
Request headers
| Header |
Required |
Type |
Explanation |
| x-west-move-source |
Yes |
String |
Path of the original file, in the format /<bucket>/<path_to_original_file> |
| x-west-meta-directive |
No |
String |
The operation mode of x-west-metadata-x is: copy (default), merge, replace, delete. For the specific meaning of each value, see description of option parameter under Metadata |
| x-west-meta-XYZ |
No |
String |
Other file metadata, see Metadata |
| x-west-automkdir |
No |
Boolean |
If the path to the file includes directories, which do not exist yet, they will be created automatically. The default value is false. |
Additional notes
- You can only copy files within the same bucket.
- Copying directories is not supported
Response
- Upon success, the status code 200 will be returned.
- If failed, an error message will be returned. Please refer to the API Error Code Table for details.
2.5. Download files
GET /<bucket>/<path_to_file>
Request headers
| Header |
Required |
Type |
Explanation |
| Range |
No |
String |
Can be used to download only a certain block of the file, see Range header explanation. |
Response
- Upon success, the status code 200 will be returned.
- If failed, an error message will be returned. Please refer to the API Error Code Table for details.
2.6. Deleting files
DELETE /<bucket>/<path_to_file>
Request headers
| Header |
Required |
Type |
Explanation |
| x-west-async |
No |
Boolean |
Asynchronous processing of the request. Default value is false. |
Additional notes
- A frequency limit may be imposed on synchronous deletion requests. If you need to delete a large number of files, asynchronous is recommended.
- For asynchronous deletions, the request will return the status code 200 immediately, even though the file may not be deleted yet.
Response
- Upon success, the status code 200 will be returned.
- If failed, an error message will be returned. Please refer to the API Error Code Table for details.
2.7. Get file information
HEAD /<bucket>/<path_to_file>
Response
- Upon success, the status code 200 will be returned. The response also includes the response headers listed below.
- If failed, an error message will be returned. Please refer to the API Error Code Table for details.
| Header |
Explanation |
| x-west-file-type |
Mime type of the file |
| x-west-file-size |
File size in bytes |
| x-west-file-date |
File creation date |
| x-west-meta-XYZ |
Returns the meta information of the file. Each meta information is sent in a corresponding HTTP header. |
2.8. Modify file metadata
PATCH /<bucket>/<path_to_file>?metadata=<option>
Options
| Option |
Explanation |
| merge (default) |
Merge file meta information. If the meta information is the same, it will be replaced by the newly uploaded value. |
| replace |
Replace the file meta information with the new meta information. |
| delete |
Delete file meta information. |
Request headers
| Header |
Required |
Type |
Explanation |
| x-west-meta-XYZ |
No |
String |
Set a value for this meta information. |
| Content-Secret |
No |
String |
Set a value for this meta information. |
| Content-Type |
No |
String |
Set a value for this meta information. |
Response
- Upon success, the status code 200 will be returned.
- If failed, an error message will be returned. Please refer to the API Error Code Table for details.
2.9. Create a directory
POST /<bucket>/<path_to_directory>
Request headers
| Header |
Required |
Type |
Explanation |
| folder |
Yes |
Boolean |
The value must be true. |
Response
- Upon success, the status code 200 will be returned.
- If failed, an error message will be returned. Please refer to the API Error Code Table for details.
2.10. Delete a directory
DELETE /<bucket>/<path_to_directory>
Additional notes
- Only empty directories are allowed to be deleted.
- If there are still files in the directory, the deletion request will fail. You need to delete all files in the directory first, before you can delete the directory.
Response
- Upon success, the status code 200 will be returned.
- If failed, an error message will be returned. Please refer to the API Error Code Table for details.
2.11. Get a list of files within a directory
GET /<bucket>/<path_to_directory>
Request headers
| Header |
Required |
Type |
Explanation |
| x-list-iter |
No |
String |
The name of the iterator, which can be used to through multiple pages of files in a directory. |
| x-list-limit |
No |
Integer |
The number of files to be retrieved. Default is 100, maximum is 10000. |
| x-list-order |
No |
String |
Possible values: asc or desc. The default is asc. The list will be sorted based on the file names. |
Additional notes
- If the number of files in a directory exceed the value of x-list-limit, the files will be seperated into multiple pages and the response will only include the first page as well as the name of the iterator for the next page.
- In order to receive the next page, another request needs to be sent and this request needs to include the name of the iterator that was received in the previous request.
- The name of the iterators are based on Base64-encoded random numbers. If the name of the iterator is "bmV4dCBpbmRleDpFT0Y=", it indicates the last page.
Response
- Upon success, the status code 200 will be returned. The response also includes the list of files in a JSON format.
- If failed, an error message will be returned. Please refer to the API Error Code Table for details.
3. S3 API
The S3 API is based on the REST API and provides additional options and parameters to make it as compatible with the S3 API from AWS as possible.
3.1. Compatibility overview
- S3 API supports file-related API calls.
- Region-related configuration is not supported.
- Authentication is compatible with both AWS Signature Version 2 and AWS Signature Version 4.
- You need to use the username as AccessKey and the password as SecretAccessKey.
| Header |
Compatiblity |
| Authorization |
Yes |
Content-Length
|
Yes |
Content-MD5
|
Yes |
Content-Type
|
Yes |
Date
|
Yes |
Host
|
Yes |
x-amz-content-sha256
|
Yes |
x-amz-date
|
Yes |
x-amz-security-token
|
No |
| Header |
Compatiblity |
| Content-Length |
Yes |
| Content-Type |
Yes |
| ETag |
Yes |
| Date |
Yes |
| x-amz-delete-marker |
No |
| x-amz-request-id |
Yes |
| x-amz-id-2 |
No |
| x-amz-version-id |
No |
3.2. Upload files
PUT /<bucket>/<path_to_file>
Additional request headers
| Request headers |
Required |
Type |
Explanation |
| Content-Length |
Yes |
Integer |
Request content length |
| Content-MD5 |
No |
String |
MD5 value of the uploaded file. If the file in the request is too large to calculate MD5, it can be left blank. |
| Content-Type |
No |
String |
File mime type. By default, a common mime type will be used according to the file extension. |
| x-amz-meta-XYZ |
No |
String |
Other file metadata, see Metadata |
Additional notes
- The maximum supported single-thread file upload size is 1 GB. For files larger than 1 GB, you need to upload the file in chunks. It is generally recommended to upload the file in chunks if it is larger than 100 MB.
- Storing a large number of files in the same directory at the same time may affect performance, so it is recommended that when there are too many files, they are stored in different subdirectories.
Response
- Upon success, the status code 200 will be returned.
- If failed, an error message will be returned. Please refer to the API Error Code Table for details.
Example
PUT /<bucket>/<test.txt> HTTP/1.1 Host: <s3.webercloud-china.cn> Date: <Mon, 11 Jul 2023 03:20:29 GMT> Authorization: <authorization string> Content-Type: text/plain Content-Length: <1314>
3.3. Upload files in chunks
Initialization
Initialize the upload in chunks and obtain the globally unique UploadId. Subsequent requests for the upload in chunks require the UploadId as a request parameter.
Request:
| Parameter |
Required |
Type |
Explanation |
| x-west-multi-length |
Yes |
Integer |
The total size of the file in bytes. |
| Content-MD5 |
No |
String |
MD5 value of the uploaded file. If the file in the request is too large to calculate MD5, it can be left blank. |
| Content-Type |
No |
String |
File mime type. By default, a common mime type will be used according to the file extension. |
| x-amz-meta-XYZ |
No |
String |
Other file metadata, see Metadata |
Example:
POST /<bucket>/<test.txt>?uploads HTTP/1.1 Host: <s3.webercloud-china.cn> Date: <Mon, 11 Jul 2023 03:20:29 GMT> Authorization: <authorization string> x-west-multi-length: <1134000>
Response:
The response only includes common response headers, and provides additional information as XML in the request body.
| Request body information |
Type |
Explanation |
| InitiateMultipartUploadResult |
Container |
Container that includes the other information. |
| Bucket |
String |
The name of the bucket. |
| Key |
String |
The name of the file. |
| UploadId |
String |
The ID generated by the initialization task. Used for subsequent requests when uploading a file in chunks. |
Example:
HTTP/1.1 200 OK <?xml version = "1.0" encoding = "UTF-8" ?> <InitiateMultipartUploadResult xmlns = "http://s3.amazonaws.com/doc/2006-03-01/" > <Bucket><bucket></Bucket> <Key><test.txt></Key> <UploadId>e3868700-018b-41a3-8a9a-e093b7a22fc4</UploadId> </InitiateMultipartUploadResult>
Chunk upload
Request:
The request uses only common request headers. Additional parameters must be added as GET parameters to the URL.
| GET Parameter |
Required |
Type |
Explanation |
| PartNumber |
Yes |
Integer |
The part number of the upload. A positive integer between 1 and 10,000. |
| UploadId |
Yes |
String |
Upload task ID. It can be obtained from the response after initializing the upload of a file in chunks. |
Example:
PUT /<bucket>/<test.txt>?partNumber=<PartNumber>&uploadId=<UploadId> HTTP/1.1 Host: <s3.webercloud-china.cn> Date: <Mon, 11 Jul 2023 03:20:29 GMT> Content-Length: <1134000> Authorization: <authorization string>
Response:
- Upon success, the status code 200 will be returned.
- If failed, an error message will be returned. Please refer to the API Error Code Table for details.
Example:
HTTP/1.1 200 OK x-amz-request-id: 3141cdab-1387-4872-b6e7-e83ec0f9fc97 Date: <Wed, 12 Oct 2023 17:51:00 GMT> ETag: "b54357faf0632cce46e942fa68356b38" Content-Length: 0 Connection: keep-alive
Finalize upload
Request:
The request uses only common request headers. Additional parameters must be added as GET parameters to the URL.
| GET Parameter |
Required |
Type |
Explanation |
| UploadId |
Yes |
String |
Upload task ID. It can be obtained from the response after initializing the upload of a file in chunks. |
Additionally, the payload needs to include an XML with all parts and their corresponding ETag.
Example:
POST /<bucket>/<test.txt>?uploadId=<UploadId> HTTP/1.1 Host: <s3.webercloud-china.cn> Date: <Mon, 11 Jul 2023 03:20:29 GMT> Content-Length: <1134000> Authorization: <authorization string> <CompleteMultipartUpload> <Part> <PartNumber>1</PartNumber> <ETag>"a54357aff0632cce46d942af68356b38"</ETag> </Part> <Part> <PartNumber>2</PartNumber> <ETag>"0c78aef83f66abc1fale8477f296d394"</ETag> </Part> <Part> <PartNumber>3</PartNumber> <ETag>"acbd18db4cc2f85cedef654fccc4a4d8"</ETag> </Part> ... </CompleteMultipartUpload>
Response:
- Upon success, the status code 200 will be returned.
- If failed, an error message will be returned. Please refer to the API Error Code Table for details.
Example:
HTTP/1.1 200 OK x-amz-request-id: 3141cdab-1387-4872-b6e7-e83ec0f9fc97 Date: Wed, 12 Oct 2023 17:50:00 GMT Connection: close <?xml version="1.” encoding="UTF-8"?> <CompleteMultipartUploadResult xmlns="http://s3.amazonaws.com/doc/2006-03-01/"> <Location>https://<s3.webercloud-china.cn>/<bucket>/<test.txt></Location> <Bucket><bucket></Bucket> <Key><test.txt></Key> <ETag>"3858f62230ac3c915f300c664312c11f-9"</ETag> </CompleteMultipartUploadResult>
Additional notes
- Except for the last chunk, all chunks need to have a size of exactly 1 MB.
- In order to upload a file in chunks, the upload needs to be initialized first.
- After initialization is completed, blocks can be uploaded in parallel.
- Once all chunks have been uploaded, the upload needs to be finalized.
3.4. Copy files
PUT /<bucket>/<new_path_to_file>
Additional request headers
| Request header |
Required |
Type |
Explanation |
| x-amz-copy-source |
Yes |
String |
Path of the original file, in the format /<bucket>/<path_to_original_file> |
Additional notes
- You can only copy files within the same bucket.
- Directories cannot be copied.
Response
- Upon success, the status code 200 will be returned.
- If failed, an error message will be returned. Please refer to the API Error Code Table for details.
Example
PUT /<bucket>/<test.txt> HTTP/1.1 Host: <s3.webercloud-china.cn> Date: <Wed, 12 Oct 2023 17:50:00 GMT> x-amz-copy-source: /<bucket>/<copy.txt> Authorization: <authorization string> HTTP/1.1 200 OK x-amz-request-id: 3141cdab-1337-4872-b6e7-e83ec0f9fc97 Date: Wed, 28 Oct 2009 22:32:00 GMT Connection: close <CopyObjectResult> <LastModified>2023-10-12T17:50:30.000Z</LastModified> <ETag>"9b2cf535f27731c974343645a3985328"</ETag> </CopyObjectResult>
3.5. Download files
GET /<bucket>/<path_to_file>
Request headers
| Header |
Required |
Type |
Explanation |
| Range |
No |
String |
Can be used to download only a certain block of the file, see Range header explanation. |
Response
- Upon success, the status code 200 will be returned.
- If failed, an error message will be returned. Please refer to the API Error Code Table for details.
3.6. Deleting files
DELETE /<bucket>/<path_to_file>
Response
- Upon success, the status code 200 will be returned.
- If failed, an error message will be returned. Please refer to the API Error Code Table for details.
3.7. Get file information
HEAD /<bucket>/<path_to_file>
Response
- Upon success, the status code 200 will be returned. The response also includes the response headers listed below.
- If failed, an error message will be returned. Please refer to the API Error Code Table for details.
| Header |
Explanation |
| Last-Modified |
Last modified date of the file |
| ETag |
A hash value of the resource content, used to indicate changes in the object content, not changes in metadata. The ETag value is not always the MD5 value of the object data, depending on how the request is made. |
| x-amz-meta-XYZ |
Returns the meta information of the file. Each meta information is sent in a corresponding HTTP header. |
3.8. Get a list of files within a directory
GET /<bucket>/<path_to_directory>?list-type=2
Request
The request uses only common request headers. Additional parameters must be added as GET parameters to the URL.
| GET Parameter |
Required |
Type |
Explanation |
| list-type |
Yes |
Integer |
Version 2 of the API requires this parameter and must be set to 2. |
| max-keys |
No |
Integer |
The maximum number of resources to return. The default value is 1000. |
prefix
|
No |
String |
Specify a prefix, only resources whose names match the prefix will be listed. The default value is an empty string. |
delimiter
|
No |
String |
Specify the directory separator, listing all common prefixes (simulating the effect of listing a directory). The default value is an empty string. |
Response
- Upon success, the status code 200 will be returned. The response also includes the list of files in an XML format.
- If failed, an error message will be returned. Please refer to the API Error Code Table for details.
| Request body information |
Type |
Explanation |
| Delimiter |
String |
The specified seperator for directories. |
| IsTruncated |
Boolean |
This parameter is set to false when all results have been returned and true when more resources can be returned. If the number of results exceeds the number specified by MaxKeys, not all results will be included in the response. |
| MaxKeys |
Integer |
The specified maximum number of resources to return. |
| Prefix |
String |
The specified prefix for resources, which should be returned. |
ContinuationToken
|
String |
If a Continuation Token was included in the request, it will be included in the response. |
NextContinuationToken
|
String |
If the response is truncated, this token needs to be included in the next request, if you want to get the next batch of resources. |
CommonPrefixes
|
String |
Count resources merged to a common prefix as a single return, and list resources that act as subdirectories. |
ETag
|
String |
The MD5 hash of the object. The ETag reflects only changes to the object's contents, not its metadata. |
Key
|
String |
Resource name |
LastModified
|
String |
Last modified date of the file |
Size
|
Integer |
The size of the object in bytes |
Example
GET /<bucket>/?list-type = 2 HTTP/1.1 Host: <s3.webercloud-china.cn> X-Amz-Date: <20230628T063714Z> Authorization: <authorization string> Content-Type: text/plain HTTP/1.1 200 OK <?xml version = "1.0" encoding = "UTF-8" ?> <ListBucketResult xmlns = "http://fss-my.vhostgo.com/doc/2006-03-01/" > <Name><bucket></Name> <Prefix/> <KeyCount>205</KeyCount> <MaxKeys>1000</MaxKeys> <IsTruncated>false</IsTruncated> <Contents> <Key>test.txt</Key> <LastModified>2022-10-12T17:50:30.0Z</LastModified> <ETag>"fba9dede5f27731c9771645a39863328"</ETag> <Size>434234</Size> <StorageClass>STANDARD</StorageClass> </Contents> <Contents> ... </Contents> ... </ListBucketResult>
4. API Error Code Table
When an API request fails, the server will return a response body in JSON format. It can be used to locate the specific cause of the error. For example:
{"msg":"authorization error","code":401000002,"id":"238235e6-8160-48ed-a9b2-1309938b09a9"}
This JSON response includes the following information:
- msg: A brief description of the error.
- id: A unique ID related to this request.
- code: The error code. For specific meanings, refer to the table below.
| HTTP status code |
Error code |
Error message |
Explanation |
| 400 |
400000001 |
file size error |
Abnormal file size |
| 400 |
400000002 |
file or folder already exists |
The file or directory already exists |
| 400 |
400000003 |
wrong uri |
URI error |
| 400 |
400000004 |
wrong bucket auth |
Bucket authentication error |
| 400 |
400000005 |
bucket must have an administrator user |
An administrator account is required |
| 400 |
400000006 |
bucket not allowed delete administrator user |
Unauthorized deletion of administrator account |
| 400 |
400000007 |
bucket log to save day error |
Abnormal number of days for log retention |
| 400 |
400000008 |
bucket naming error |
Bucket name abnormal |
| 400 |
400000009 |
request body too big |
The access request body is too large |
| 400 |
400000010 |
read body error |
Exception in reading request body |
| 400 |
400000011 |
wrong content-md5 |
Wrong file md5 encryption information |
| 400 |
400000012 |
directory not empty |
There are still files in the directory |
| 400 |
400000013 |
wrong meta operation mode |
Wrong meta operation type |
| 400 |
400000014 |
bucket quota error |
Bucket quota exception |
| 400 |
400000015 |
bucket not enough space |
Not Enough Space |
| 400 |
400000016 |
wrong x-west-multi-stage |
The x-west-multi-stage parameter value is incorrect |
| 400 |
400000017 |
wrong x-west-list-iter |
The x-west-list-iter parameter value is incorrect |
| 400 |
400000018 |
wrong expire time |
Expiration time exception |
| 400 |
400000019 |
wrong index |
Index exception |
| 400 |
400000020 |
wrong object type |
Object type exception |
| 400 |
400000021 |
file not upload all block |
Large file upload is not completed |
| 400 |
400000022 |
violation of access policy |
Access policy violation |
| 400 |
400100001 |
wrong img load |
Image loading failed |
| 400 |
400100002 |
wrong img exifset |
The exif attribute is incorrect |
| 400 |
400100003 |
wrong img getinfo |
Failed to obtain image information |
| 400 |
400100004 |
wrong img zoom |
Image scaling failed |
| 400 |
400100005 |
wrong img crop |
Image cropping failed |
| 400 |
400100006 |
wrong img water |
Failed to generate watermark for the image |
| 400 |
400100007 |
wrong img rotate |
Image rotation failed |
| 400 |
400100008 |
wrong img flip |
Image mirror flip failed |
| 400 |
400100009 |
wrong img sharp |
Image sharpening failed |
| 400 |
400100010 |
wrong img gauss |
Gaussian blur failed |
| 400 |
400100011 |
wrong img border |
Failed to add image border |
| 400 |
400100012 |
wrong img canvas |
Image canvas setting failed |
| 400 |
400100013 |
wrong img set |
Image setting failed |
| 400 |
400100014 |
wrong img save |
Failed to save image |
| 400 |
400100015 |
wrong img param |
Abnormal image parameters |
| 401 |
401000001 |
unknown realm in authorization header |
Unknown domain in the Authorization request header |
| 401 |
401000002 |
authorization error |
Authentication failed |
| 401 |
401000004 |
invalid date value in header |
Invalid date format |
| 403 |
403000001 |
authorization has expired |
Signature has expired |
| 403 |
403000002 |
Forbidden |
Forbidden |
| 403 |
403000003 |
has no permission to operation |
No operation permission |
| 403 |
403000004 |
has no permission to read |
No read permission |
| 403 |
403000005 |
bucket forbidden |
Bucket access denied |
| 403 |
403100001 |
no permission |
The file has a password and verification failed |
| 403 |
403100002 |
no permission http read |
Referer is empty, verification failed |
| 403 |
403100003 |
no permission http read |
Referer blacklist match successful |
| 403 |
403100004 |
no permission http read |
Referer whitelist match failed |
| 403 |
403100005 |
no permission http read |
Agent blacklist matching successful |
| 403 |
403100006 |
no permission http read |
Agent whitelist matching failed |
| 403 |
403100007 |
no permission http read |
Anti-hotlink token verification failed |
| 403 |
403100008 |
no permission http read |
Anti-hotlink token verification failed |
| 404 |
404000001 |
file or folder not found |
File or directory not found |
| 404 |
404000002 |
bucket not found |
Bucket does not exist |
| 404 |
404000003 |
big file not upload sucess |
Large files cannot be accessed because they have not been fully uploaded yet |
| 405 |
405000001 |
Method Not Allowed |
Rejected request method |
|