Skip to content

Common

Upload Files

Description

This api supports file upload and returns back the upload URL.

Request Config

ConfigDefinition
URL/op/upload
MethodPOST
Content-Typemultipart/form-data

form-data Definition

NameTypeDescriptionRequired
filefileThe files that need to be uploaded support the following formats: jpg, png, svg, pdf, xlsx.Yes
watermarkstringAdd 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:

NameTypeDescriptionRequired
data[]stringArray of text watermark contents, supporting up to 10 items.Yes
separatorstringThe 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

NameTypeDescription
file_urlstringUploaded file url
md5stringUploaded file md5 value
file_sizeintUploaded file size
watermark_infoobjectWatermark image info
+ file_urlstringWatermark image file url
+ md5stringWatermark image md5 value
+ file_sizeintWatermark 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
    }
  }
}

Powered by Clobotics Retail Team.