Common
Upload Files
Description
This api supports file upload and returns back the upload URL.
Request Config
| Config | Definition |
|---|---|
| URL | /op/upload |
| Method | POST |
| Content-Type | multipart/form-data |
form-data Definition
| Name | Type | Description | Required |
|---|---|---|---|
file | file | The files that need to be uploaded support the following formats: jpg, png, svg, pdf, xlsx. | Yes |
watermark | string | Add a watermark to image files. This function only supports jpg and png images. The watermark is a serialized json string; refer to Watermark Definition for details. | No |
Notes:
- The maximum file size is:
10M.
watermark Definition
json
{
"data": [
"Task Name: Zengcheng Store 1",
"Store Name: Zengcheng Store 1",
"Store Code: zz_001",
"Sales Representative: Xiaoming",
"Time: 2023-07-19 16:30:00",
"Store Address: xxxxx, Zengcheng District, Guangzhou City"
],
"separator": "auto"
}The attributes of watermark are detailed as follows:
| Name | Type | Description | Required |
|---|---|---|---|
data | []string | Array of text watermark contents, supporting up to 10 items. | Yes |
separator | string | The method to concatenate multiple watermark texts offers two options: auto (utilizing two English spaces to separate and dynamically calculate the newline position for the complete watermark text) and new_line (using a newline character). The default value is auto. | No |
Response
Schema of data
| Name | Type | Description |
|---|---|---|
| file_url | string | Uploaded file url |
| md5 | string | Uploaded file md5 value |
| file_size | int | Uploaded file size |
| watermark_info | object | Watermark image info |
| + file_url | string | Watermark image file url |
| + md5 | string | Watermark image md5 value |
| + file_size | int | Watermark image size |
Response Body Sample
json
{
"code": 0,
"message": "",
"data": {
"file_url": "https://f-api-dev.clobotics.cn/v?redirect=https%3A%2F%2Ff-dev.clobotics.cn%2F4%2F0040ca4d85f5e5ef7354102f486ef843.jpg",
"md5": "0040ca4d85f5e5ef7354102f486ef843",
"file_size": 0,
"watermark_info": {
"file_url": "https://f-api-dev.clobotics.cn/v?redirect=https%3A%2F%2Ff-dev.clobotics.cn%2F4%2F0040ca4d85f5e5ef7354102f486ef843.jpg",
"md5": "0040ca4d85f5e5ef7354102f486ef843",
"file_size": 121212
}
}
}