Skip to content

创建子码(v1) ​

v1 接口,不再更新

这个接口继续可用,但不再更新,也不支持个人 API Key,继续使用组织 Key。当前版本没有一一对应的替代接口,其他能力请优先用 API 参考,对照见从 v1 迁移到当前版本。

通过此API,你可以创建指定模板下的子码。

请求示例 ​

python
import requests
import json

url = 'https://open.cli.im/api/v1/createSubCode'

data = {
    "templateCode": "M16",
    "data": [
        {
            "fieldId": 1,
            "type": "text",
            "text": {
                "value": "openapi测试0303"
            }
        }
    ]
}

headers = {
    'Authorization': 'Bearer <你的APIKey>'  # 请替换为你的 API Key,例如 'Bearer abc123456'
}

response = requests.post(url, headers=headers, json=data)
print(response.text)

响应示例 ​

json
{
    "data": {
        "qrcodeSerialNumber": "M16-Z41",
        "qrcodeUrl": "https://qr46.cn/o6leQy/qyBVzC3",
        "qrcodeTagUrl": "https://qrapi.cliim.net/newqr/create?data=https%3A%2F%2Fqr46.cn%2Fo6leQy%2FqF19FPq&level=H&transparent=&bgcolor=%23ffffff&forecolor=%23000000&blockpixel=12&marginblock=2&logourl=&size=220&kid=bizcliim&time=1754554955&key=9b2c21895b9eb726efe08371209b8388"
    },
    "code": 0,
    "message": "ok"
}

请求详情 ​

templateCode string 必填

模板编号,eg:M16,可从批量模板页面获取。


data []CreateQrcodeField

创建子码组件列表,每一个是CreateQrcodeField对象,你可以通过下文了解组件字段的定义。

响应详情 ​

code integer

响应的业务状态码,0表示成功,非0表示失败


message string

响应的消息,通常用作错误的消息展示


data object

响应的内容


data.qrcodeSerialNumber string

子码编号


data.qrcodeUrl string

子码url


data.qrcodeUrl string

子码标签url

子码组件字段(CreateQrcodeField) ​

以下内容描述创建子码接口时子码组件数据的上送定义。

示例组件数据 ​

json
{
    "fieldId": 1,
    "type": "text",
    "text": {
        "value": "Hello World"
    }
}
json
{
    "fieldId": 2,
    "type": "textarea",
    "textarea": {
        "value": "Hello World\nHello World"
    }
}
json
{
    "fieldId": 3,
    "type": "number",
    "number": {
        "value": 123
    }
}
json
{
    "fieldId": 4,
    "type": "date",
    "date": {
        "value": "2025-03-04"
    }
}
json
{
    "fieldId": 5,
    "type": "radio",
    "radio": {
        "optionId": 1001
    }
}
json
{
    "fieldId": 6,
    "type": "checkbox",
    "checkbox": {
        "optionCreateDataList": [
            { "optionId": 1001 },
            { "optionId": 1002 }
        ]
    }
}
json
{
    "fieldId": 7,
    "type": "address",
    "address": {
        "address": "浙江省宁波市海曙区灵桥路",
        "lat": 29.85957,
        "log": 121.55084
    }
}
json
{
    "fieldId": 8,
    "type": "image",
    "image": {
        "images": [
            { "url": "https://ncstatic.clewm.net/undefined.png" }
        ]
    }
}
json
{
    "fieldId": 9,
    "type": "audio",
    "audio": {
        "title": "音频标题",
        "url": "https://ncstatic.clewm.net/undefined.mp3"
    }
}

组件详情 ​

fieldId number

组件ID,取自获取模板详情接口返回的组件ID


title string

组件标题


type string

组件类型

值说明
text文本
textarea多行文本
number数字
date日期
radio单选项
checkbox多选项
address定位
image图片
file文件

当type使用"text"时, 上送组件内容为文本, 文本内容使用text字段。当type使用"image"时, 上送组件内容为图片, 图片内容使用image字段。以此类推。目前暂不支持视频与音频组件进行子码创建。


文本组件 ​

text object

当内容是文本组件时上送

text.value string

文本内容


多行文本组件 ​

textarea object

当内容是多行文本组件时上送

textarea.value string

多行文本内容


数字组件 ​

number object

当内容是数字组件时上送

number.value number

数字内容


日期组件 ​

date object

当内容是日期组件时上送

date.value string

日期内容


单选项组件 ​

radio object

当内容是单选项组件时上送

radio.optionId number

单选项id,取自查询模板接口返回的单选项组件id

radio.otherValue string

其他选项内容,如果该选项是其他选项,则上送其他选项内容, 否则无需上送


多选项组件 ​

checkbox object

当内容是多选项组件时上送

checkbox.optionCreateDataList []object

多选项列表

checkbox.optionCreateDataList[].optionId number

多选项id,取自查询模板接口返回的多选项组件id

checkbox.optionCreateDataList[].otherValue string

其他选项内容,如果该选项是其他选项,则上送其他选项内容, 否则无需上送


定位组件 ​

address object

当内容是定位组件时上送

address.address string

地址

address.lat number

纬度

address.log number

经度


图片组件 ​

image object

当内容是图片组件时上送

image.images []object

图片内容

image.images[].url string

图片URL


文件组件 ​

file object

当内容是文件组件时上送

file.files []object

文件内容

file.files[].url string

文件URL

file.files[].title string

文件名称