최신 업데이트:2022-03-01 18:00:52
The append upload interface allows users to append content directly to an object, with each append upload data instantly readable. The object operated in this manner is called an Appendable object.
Token calculation and upload policy definition are consistent with common upload interfaces. Each append operation is performed according to normal upload policy.
Request style
POST /append/<position>
Host: <UploadDomain>
Content-Length:<appendSize>
Content-Type: multipart/form-data; boundary=<boundary>
--<boundary>
Content-Disposition: form-data; name="token"
<uploadToken>
--<boundary>
Content-Disposition: form-data; name="<x:VariableName>"
<x:VariableValue>
--<boundary>
Content-Disposition: form-data; name="key"
<key>
--<boundary>
Content-Disposition: form-data; name="mimeType"
<mimeType>
--<boundary>
Content-Disposition: form-data; name="deadline"
<deadline>
--<boundary>
Content-Disposition: form-data; name="file"; filename="原文件名"
Content-Type: application/octet-stream
<fileBinaryData>
--<boundary>--
Request message parameters
Parameter name | Description | Required |
---|---|---|
append | Indicating the way of append upload. | yes |
position | Indicating where to append and size of appendable object. | yes |
Request Headers
Header name | Required | Description |
---|---|---|
Host | yes | Upload domain name, available in the user management interface. |
Content-Length | yes | Length of append content |
Content-Length | yes | Standard MIME type. Type: string. Fixed value: multipart/form-data. |
Form description
Parameters | Required | Description |
---|---|---|
<token> | yes | Upload Credentia |
<x:VariableName> | no | Value name of custom variable. |
<key> | no | Custom filename |
<mimeType> | no | Custom file MIME-Type. |
<deadline> | no | File retention days. File exceeding retention days to be automatically deleted, unit: day. e.g., 1, 2, 3… Note: 0 for delete asap, not recommended for file uploading. |
<file> | yes | File itself |
<fileBinaryData> | yes | binary stream of file. |
Response style
HTTP/1.1 status_code
x-wcs-next-append-position:object size
x-wcs-object-type:Appendable
Server: WS-web-server
<ResponseContent>
Response headers
Header name | Required | Description |
---|---|---|
x-wcs-next-append-position | yes | Indicating position of next append. String. |
x-wcs-object-type | yes | Indicating type of object, Appendable for appendfromfile, Normal for non-Appendable. Type: string. |
Response body
If Request successes, <ResponseContent> will be the following URL-Safe Base64 Encoding:
hash=<filehash>
Field name | Required | Description |
---|---|---|
<filehash> | yes | File hash value. |
Note: if returnBody defined during uploading, returnBody will be added, for example, name=
If Request fails, <ResponseContent> will be the following Json string:
{
"code": "<code string>",
"message": "<message string>"
}
Field name | Required | Description |
---|---|---|
code | yes | HTTP request response code, see HTTP Response Status Code |
message | yes | Prompting message. |
curl -v -i -X POST -H "Expect:" -F file=@D:/8.png -F key=m.png -F token="6a69ab4062cb03059e4c13a0f5e662523effad49:ZGE1MWY1YzA4ZDgyMjVlM2Q3MmE2YjZkZDI3MmY1ZmMxNjk2YTFjOA==:eyJzY29wZSI6InRlc3QiLCJkZWFkbGluZSI6IjE0NzIxNzY2MzQwMDAiLCJvdmVyd3JpdGUiOjAsImZzaXplTGltaXQiOjAsImluc3RhbnQiOjAsInNlcGFyYXRlIjowfQ==" --url http://uploaddomain.com/append/0