Upload Attachment
Upload attachment files to the system. Supports large file chunked uploads. Upload one chunk at a time, and the system automatically merges them into a complete file after all chunks are uploaded.
Interface Address:
text
/papi/file/uploadAttachmentRequest Method:
text
POSTContent-Type:
text
multipart/form-dataHeader Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
| X-Access-Key | string | Yes | API access key ID. See API Rules for authentication |
| X-Signature | string | Yes | Signature value, Base64-encoded HMAC-SHA256 hash |
| X-Timestamp | string | Yes | Millisecond Unix timestamp (13 digits) |
| X-Nonce | string | Yes | Random string, 10-32 lowercase alphanumeric characters |
Body Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
| md5 | string | Yes | File MD5 value |
| partNumber | integer | Yes | Chunk index |
| file | file | Yes | Chunk file stream |
| totalChunks | integer | Yes | Total number of chunks |
| fileSuffix | string | Yes | File suffix (including dot, e.g., .jpg) |
| fileName | string | Yes | File name |
| totalSize | integer | Yes | Total file size |
| targetPath | string | No | Directory |
| ctrIds | array[string] | No | Cloud phone ctrIds |
Note: This API uses
multipart/form-dataformat.
Request Example:
text
md5: 24264aaf4064feb1f7e1fe8e6044aa3e
partNumber: 1
file: <binary>
totalChunks: 1
fileSuffix: .png
fileName: 3Response Parameters:
| Parameter | Type | Description |
|---|---|---|
| code | integer | Error code. See Error Codes |
| data | object | Response data |
| ├─ md5 | string | File MD5 |
| ├─ partNumber | integer | Current chunk number |
| ├─ uploadedChunks | array[string] | List of uploaded chunks |
| ├─ totalChunks | integer | Total number of chunks |
| ├─ url | string | File URL, returned only when upload is complete |
| ├─ appSid | string | - |
| msg | string | Error message |
Response Example:
json
{
"code": 0,
"data": {
"md5": "",
"partNumber": 0,
"uploadedChunks": [""],
"totalChunks": 0,
"url": "",
"appSid": ""
},
"msg": ""
}