Skip to content

1. 数据填报

1.1. GET 获取填写的表单数据

http
GET /api/surveys/{id}/data HTTP/1.1
Accept: application/json
Cookie: csrf=183f1c4...; sid=26ee552d...; _USER_SESSION_ID=f2a01083...

获取填写的表单数据,仅表单所有者有权限进行查看。

1.1.1. 请求参数

名称位置类型必选说明
idpathstringnone
offsetqueryintegernone
limitqueryintegernone
http
HTTP/1.1 200 Ok
Content-Type: application/json

{
  "version": "version@9a5e106#6730f0d",
  "code": 0,
  "msg": "success",
  "data": {
    "data": [
      [
        "你的名字",
        32,
        2,
        null,
        "2023-08-10 17:58:58.000",
        2,
        null,
        "2023-08-10 17:58:58.000",
        "a5048bef2ee54b2bbe83f80f90783a0c"
      ],
      [
        "你的名字",
        32,
        2,
        null,
        "2023-08-10 18:02:09.000",
        2,
        null,
        "2023-08-10 18:02:09.000",
        "c435f5029fb940abb20cac9fdb3abfc5"
      ],
      [
        "as da",
        null,
        2,
        null,
        "2023-08-10 18:05:23.000",
        2,
        null,
        "2023-08-10 18:05:23.000",
        "86cd0e76dcd345ccb3f08fc6f39d9783"
      ]
    ],
    "mapData": [],
    "schema": [
      {
        "fieldName": "name",
        "tags": {},
        "defaultAggrType": "count",
        "basicType": "string",
        "suggestedTypes": [
          "string"
        ],
        "hideValue": false,
        "nativeType": "LONGTEXT",
        "originType": "string",
        "oriName": "01H7FBCSERDZJG59S52TKJTQ7K",
        "visible": true,
        "config": {},
        "type": "string",
        "label": "你叫什么呀",
        "comment": "你叫什么呀"
      },
      {
        "fieldName": "age",
        "tags": {},
        "defaultAggrType": "sum",
        "basicType": "number",
        "suggestedTypes": [
          "number"
        ],
        "hideValue": false,
        "nativeType": "NUMERIC(65,10)",
        "originType": "number",
        "oriName": "01H7FBE8TNVNJ0257YSPQMNNJF",
        "visible": true,
        "config": {},
        "type": "number",
        "label": "年龄多少",
        "comment": "年龄多少"
      },
      {
        "fieldName": "hs_updater_id",
        "tags": {},
        "defaultAggrType": "sum",
        "basicType": "number",
        "suggestedTypes": [
          "number"
        ],
        "hideValue": false,
        "originType": "integer",
        "visible": true,
        "config": {},
        "type": "number"
      },
      {
        "fieldName": "hs_updater_company",
        "tags": {},
        "defaultAggrType": "sum",
        "basicType": "number",
        "suggestedTypes": [
          "number"
        ],
        "hideValue": false,
        "originType": "integer",
        "visible": true,
        "config": {},
        "type": "number"
      },
      {
        "fieldName": "hs_update_time",
        "tags": {},
        "defaultAggrType": "year",
        "basicType": "date",
        "suggestedTypes": [
          "date"
        ],
        "hideValue": false,
        "originType": "time",
        "visible": true,
        "config": {},
        "type": "date"
      },
      {
        "fieldName": "hs_user_id",
        "tags": {},
        "defaultAggrType": "sum",
        "basicType": "number",
        "suggestedTypes": [
          "number"
        ],
        "hideValue": false,
        "originType": "integer",
        "visible": true,
        "config": {},
        "type": "number"
      },
      {
        "fieldName": "hs_user_company",
        "tags": {},
        "defaultAggrType": "sum",
        "basicType": "number",
        "suggestedTypes": [
          "number"
        ],
        "hideValue": false,
        "originType": "integer",
        "visible": true,
        "config": {},
        "type": "number"
      },
      {
        "fieldName": "hs_create_time",
        "tags": {},
        "defaultAggrType": "year",
        "basicType": "date",
        "suggestedTypes": [
          "date"
        ],
        "hideValue": false,
        "originType": "time",
        "visible": true,
        "config": {},
        "type": "date"
      },
      {
        "fieldName": "hs_row_id",
        "tags": {},
        "defaultAggrType": "count",
        "basicType": "string",
        "suggestedTypes": [
          "string"
        ],
        "hideValue": false,
        "originType": "string",
        "visible": true,
        "config": {},
        "type": "string"
      }
    ],
    "pagable": true,
    "importSwitchable": true,
    "totalHits": 3
  },
  "chartDataStartTimeMillis": 0
}

1.1.2. 返回结果

状态码状态码含义说明数据模型
200OK成功Inline

1.1.3. 返回数据结构

1.2. GET 获取填报模板列表

http
GET /api/surveys HTTP/1.1
Accept: application/json
Cookie: csrf=183f1c4...; sid=26ee552d...; _USER_SESSION_ID=f2a01083...

返回包含简单填报模板信息的列表。

1.2.1. 请求参数

名称位置类型必选说明
titlequerystring填报模板名字
orderByquerystringnone
orderTypequerystringnone
offsetqueryintegernone
limitqueryintegernone

返回示例

http
HTTP/1.1 200 OK
Content-Type: application/json

{
  "version": "version@9a5e106#6730f0d",
  "code": 0,
  "msg": "success",
  "data": [
    {
      "id": 30,
      "title": "演示接口1",
      "status": "CLOSED",
      "createdBy": 2,
      "createdAt": "2023-08-10 16:53:28",
      "updatedBy": 2,
      "updatedAt": "2023-08-10 16:53:28",
      "options": {
        "version": 4.4
      }
    },
    {
      "id": 29,
      "title": "新建一个演示一下",
      "formTitle": "一个表单",
      "status": "OPEN",
      "connectionId": 50,
      "tablePath": [
        "数据集成"
      ],
      "table": "test_810_1",
      "createdBy": 2,
      "createdAt": "2023-08-10 16:36:41",
      "updatedBy": 2,
      "updatedAt": "2023-08-10 17:47:45",
      "options": {
        "submitButton": {
          "title": "提交"
        },
        "resetButton": {
          "title": "重制",
          "enable": true
        },
        "canUpdateData": true,
        "canLookupData": true,
        "canImportData": true,
        "version": 4.4
      }
    }
  ],
  "totalHits": 22,
  "offset": 0,
  "chartDataStartTimeMillis": 0
}

1.2.2. 返回结果

状态码状态码含义说明数据模型
200OK成功Inline

1.2.3. 返回数据结构

1.3. POST 创建填报模板

创建数据填报模板。

http
POST /api/surveys HTTP/1.1
Accept: application/json
Cookie: csrf=183f1c4...; sid=26ee552d...; _USER_SESSION_ID=f2a01083...

// Request Body:
{
  "title": "string"
}

1.3.1. 请求参数

名称位置类型必选说明
bodybodyobjectnone
» titlebodystringnone

返回示例

http
HTTP/1.1 200 OK
Content-Type: application/json

{
  "version": "version@9a5e106#6730f0d",
  "code": 0,
  "msg": "success",
  "data": {
    "id": 30,
    "title": "演示接口1",
    "status": "CLOSED",
    "createdBy": 2,
    "createdAt": "2023-08-10 16:53:28",
    "updatedBy": 2,
    "updatedAt": "2023-08-10 16:53:28",
    "options": {
      "version": 4.4
    }
  },
  "chartDataStartTimeMillis": 0
}

1.3.2. 返回结果

状态码状态码含义说明数据模型
200OK成功Inline

1.3.3. 返回数据结构

状态码 200

名称类型必选约束中文名说明
» versionstringtruenonenone
» codeintegertruenonenone
» msgstringtruenonenone
» dataobjecttruenonenone
»» idintegertruenone模板id
»» titlestringtruenone模板名称
»» statusstringtruenone模板填报开启状态
»» createdByintegertruenone模板创建者id
»» createdAtstringtruenone模板创建时间
»» updatedByintegertruenone模板最后修改者
»» updatedAtstringtruenone模板最后修改时间
»» optionsobjecttruenonenone
»»» versionnumbertruenone模板当前版本
» chartDataStartTimeMillisintegertruenonenone

1.4. GET 根据ID查询模板模板

http
GET /api/surveys/{id} HTTP/1.1
Accept: application/json
Cookie: csrf=183f1c4...; sid=26ee552d...; _USER_SESSION_ID=f2a01083...

根据id查询数据填报模板的详细信息。

1.4.1. 请求参数

名称位置类型必选说明
idpathstringnone

返回示例

http
HTTP/1.1 200 Ok
Content-Type: application/json

{
  "version": "version@9a5e106#6730f0d",
  "code": 0,
  "msg": "success",
  "data": {
    "id": 29,
    "title": "新建一个演示一下",
    "formTitle": "一个表单",
    "status": "OPEN",
    "connectionId": 50,
    "tablePath": [
      "数据集成"
    ],
    "table": "test_810_1",
    "createdBy": 2,
    "createdAt": "2023-08-10 16:36:41",
    "updatedBy": 2,
    "updatedAt": "2023-08-10 17:47:45",
    "options": {
      "submitButton": {
        "title": "提交"
      },
      "resetButton": {
        "title": "重制",
        "enable": true
      },
      "canUpdateData": true,
      "canLookupData": true,
      "canImportData": true,
      "version": 4.4
    },
    "controls": [
      {
        "uuid": "01H7FBCSERDZJG59S52TKJTQ7K",
        "inputType": "singleLineText",
        "title": "你叫什么呀",
        "fieldName": "name",
        "required": true,
        "options": {
          "maxLength": 10,
          "placeholder": "输入姓名"
        }
      },
      {
        "uuid": "01H7FBE8TNVNJ0257YSPQMNNJF",
        "inputType": "numberInput",
        "title": "年龄多少",
        "fieldName": "age",
        "required": false,
        "options": {
          "maxValue": 100,
          "minValue": 0,
          "onlyInteger": true,
          "placeholder": "输入数字好吗"
        }
      }
    ]
  },
  "chartDataStartTimeMillis": 0
}

1.4.2. 返回结果

状态码状态码含义说明数据模型
200OK成功Inline

1.4.3. 返回数据结构

状态码 200

名称类型必选约束中文名说明
» codeintegertruenonenone
» dataobjecttruenonenone
»» idintegertruenone填报模板id
»» titlestringtruenone填报模板标题
»» tablestringtruenone填报模板绑定数据库表名
»» createdByintegertruenone填报模版创建者id
»» updatedByintegertruenone填报模板最后一次修改者id
»» createdAtstringtruenone填报模板创建时间
»» updatedAtstringtruenone填报模板最后一次修改时间
»» optionsobjecttruenonenone
»»» submitButtonobjecttruenonenone
»»»» titlestringtruenone提交按钮文本
»»» resetButtonobjecttruenonenone
»»»» enablebooleantruenone是否提供重置按钮
»»»» titlestringtruenone重置按钮文本
»»» canUpdateDatabooleantruenone能否更新历史填写的数据
»»» canLookupDatabooleantruenone能否查看历史填写的数据
»»» canImportDatabooleantruenone能否批量导入数据
»»» versionnumbertruenone当前填报模板版本
»» formTitlestringtruenone填报表单标题
»» statusstringtruenone模板填报开启状态
»» connectionIdintegertruenone填报模板绑定数据连接id
»» tablePath[string]truenone填报模板绑定数据库表路径
»» controls[object]truenone控件列表
»»» uuidstringtruenonenone
»»» inputTypestringtruenonenone
»»» titlestringtruenonenone
»»» fieldNamestringtruenonenone
»»» requiredbooleantruenonenone
»»» optionsobjecttruenonenone
»»»» maxLengthintegerfalsenonenone
»»»» placeholderstringtruenonenone
»»»» maxValueintegertruenonenone
»»»» minValueintegertruenonenone
»»»» onlyIntegerbooleantruenonenone
» versionstringtruenonenone
» msgstringtruenonenone
» chartDataStartTimeMillisintegertruenonenone

1.5. PUT 更新填报模板

更新填报模板信息。

http
PUT /api/surveys/{id} HTTP/1.1
Content-Type: application/json
Cookie: csrf=183f1c4...; sid=26ee552d...; _USER_SESSION_ID=f2a01083...

// Request Body:
{
  "connectionId": 50,
  "tablePath": [
    "数据集成"
  ],
  "table": "test_810_1",
  "options": {
    "version": 4.4,
    "resetButton": {
      "enable": true,
      "title": "重制"
    },
    "canLookupData": true,
    "canUpdateData": true,
    "canImportData": true,
    "submitButton": {
      "title": "提交"
    }
  },
  "formTitle": "一个表单",
  "controls": [
    {
      "uuid": "01H7FBCSERDZJG59S52TKJTQ7K",
      "title": "你叫什么呀",
      "inputType": "singleLineText",
      "fieldName": "name",
      "required": true,
      "options": {
        "maxLength": 10,
        "placeholder": "输入姓名"
      }
    },
    {
      "uuid": "01H7FBE8TNVNJ0257YSPQMNNJF",
      "title": "年龄多少",
      "inputType": "numberInput",
      "fieldName": "age",
      "required": false,
      "options": {
        "maxValue": 100,
        "minValue": 0,
        "onlyInteger": true,
        "placeholder": "输入数字好吗"
      }
    }
  ]
}

1.5.1. 请求参数

名称位置类型必选说明
idpathintegernone
bodybodyobjectnone
» connectionIdbodyinteger模板绑定数据连接id
» tablePathbody[string]模板绑定数据库表路径
» tablebodystring模板绑定数据库表名
» optionsbodyobjectnone
»» submitButtonbodyobjectnone
»»» titlebodystring提交按钮文本
»» resetButtonbodyobjectnone
»»» enablebodyboolean开启重置按钮
»»» titlebodystring重置按钮文本
»» versionbodynumber模板版本号
»» canLookupDatabodyboolean能否查看过往填写的数据数据
»» canUpdateDatabodyboolean能否更新过往填写的数据
»» canImportDatabodyboolean能否批量导入数据
» controlsbody[object]控件组
»» requiredbodyboolean是否必填
»» optionsbodyobject各控件独有配置
»» uuidbodystring控件唯一标识
»» titlebodystring控件标题
»» inputTypebodystring控件类型
»» fieldNamebodystring控件绑定数据表列名
» formTitlebodystring填报表单名称

返回示例

http
HTTP/1.1 200 Ok
Content-Type: application/json

{
  "version": "version@9a5e106#6730f0d",
  "code": 0,
  "msg": "null",
  "data": {
    "id": 29,
    "title": "新建一个演示一下",
    "formTitle": "一个表单",
    "status": "CLOSED",
    "connectionId": 50,
    "tablePath": [
      "数据集成"
    ],
    "table": "test_810_1",
    "createdBy": 2,
    "createdAt": "2023-08-10 16:36:41",
    "updatedBy": 2,
    "updatedAt": "2023-08-10 17:20:16",
    "options": {
      "submitButton": {
        "title": "提交"
      },
      "resetButton": {
        "title": "重制",
        "enable": true
      },
      "canUpdateData": true,
      "canLookupData": true,
      "canImportData": true,
      "version": 4.4
    },
    "controls": [
      {
        "uuid": "01H7FBCSERDZJG59S52TKJTQ7K",
        "inputType": "singleLineText",
        "title": "你叫什么呀",
        "fieldName": "name",
        "required": true,
        "options": {
          "maxLength": 10,
          "placeholder": "输入姓名"
        }
      },
      {
        "uuid": "01H7FBE8TNVNJ0257YSPQMNNJF",
        "inputType": "numberInput",
        "title": "年龄多少",
        "fieldName": "age",
        "required": false,
        "options": {
          "maxValue": 100,
          "minValue": 0,
          "onlyInteger": true,
          "placeholder": "输入数字好吗"
        }
      }
    ]
  },
  "chartDataStartTimeMillis": 0
}

1.5.2. 返回结果

状态码状态码含义说明数据模型
200OK成功Inline

1.5.3. 返回数据结构

1.6. DELETE 删除填报模板

http
DELETE /api/surveys/{id} HTTP/1.1
Content-Type: application/json
Cookie: csrf=183f1c4...; sid=26ee552d...; _USER_SESSION_ID=f2a01083...

删除指定的数据填报模板。

1.6.1. 请求参数

名称位置类型必选说明
idpathstringnone

返回示例

http
HTTP/1.1 200 Ok
Content-Type: application/json

{
  "version": "version@9a5e106#6730f0d",
  "code": 0,
  "msg": "success",
  "chartDataStartTimeMillis": 0
}

1.6.2. 返回结果

状态码状态码含义说明数据模型
200OK成功Inline

1.6.3. 返回数据结构

1.7. GET 获取填报表单信息

http
GET /api/surveys/{id}/submit HTTP/1.1
Accept: application/json
Cookie: csrf=183f1c4...; sid=26ee552d...; _USER_SESSION_ID=f2a01083...

返回填报表单配置。

1.7.1. 请求参数

名称位置类型必选说明
idpathintegernone

返回示例

http
HTTP/1.1 200 Ok
Content-Type: application/json

{
  "version": "version@9a5e106#6730f0d",
  "code": 0,
  "msg": "success",
  "data": {
    "title": "新建一个演示一下",
    "formTitle": "一个表单",
    "status": "OPEN",
    "options": {
      "submitButton": {
        "title": "提交"
      },
      "resetButton": {
        "title": "重制",
        "enable": true
      },
      "canUpdateData": true,
      "canLookupData": true,
      "canImportData": true,
      "version": 4.4
    },
    "controls": [
      {
        "uuid": "01H7FBCSERDZJG59S52TKJTQ7K",
        "inputType": "singleLineText",
        "title": "你叫什么呀",
        "fieldName": "name",
        "required": true,
        "options": {
          "maxLength": 10,
          "placeholder": "输入姓名"
        }
      },
      {
        "uuid": "01H7FBE8TNVNJ0257YSPQMNNJF",
        "inputType": "numberInput",
        "title": "年龄多少",
        "fieldName": "age",
        "required": false,
        "options": {
          "maxValue": 100,
          "minValue": 0,
          "onlyInteger": true,
          "placeholder": "输入数字好吗"
        }
      }
    ]
  },
  "chartDataStartTimeMillis": 0
}

1.7.2. 返回结果

状态码状态码含义说明数据模型
200OK成功Inline

1.7.3. 返回数据结构

1.8. POST 填写表单

提交填写的表单内容。以一组控件id与填写内容的键值对为RequestBody。

http
POST /api/surveys/{id}/submit HTTP/1.1
Content-Type: application/json
Cookie: csrf=183f1c4...; sid=26ee552d...; _USER_SESSION_ID=f2a01083...

// Request Body:
{
  "01H7FBCSERDZJG59S52TKJTQ7K": "你的名字",
  "01H7FBE8TNVNJ0257YSPQMNNJF": 32
}

1.8.1. 请求参数

名称位置类型必选说明
idpathintegernone
bodybodyobjectnone

返回示例

http
HTTP/1.1 200 Ok
Content-Type: application/json

{
  "version": "version@9a5e106#6730f0d",
  "code": 0,
  "msg": "success",
  "chartDataStartTimeMillis": 0
}

1.8.2. 返回结果

状态码状态码含义说明数据模型
200OK成功Inline

1.8.3. 返回数据结构

1.9. GET 获取填报模板设置

http
GET /api/surveys/{id}/setting HTTP/1.1
Accept: application/json
Cookie: csrf=183f1c4...; sid=26ee552d...; _USER_SESSION_ID=f2a01083...

获取填报模板的额外配置设置信息。

1.9.1. 请求参数

名称位置类型必选说明
idpathintegernone

返回示例

http
HTTP/1.1 200 Ok
Content-Type: application/json

{
  "version": "version@9a5e106#6730f0d",
  "code": 0,
  "msg": "success",
  "data": {
    "title": "新建一个演示一下",
    "status": "OPEN",
    "allowUsers": {
      "grantors": [
        {
          "id": 17,
          "action": "read",
          "email": "jyuser@qq.com",
          "name": "jyuser"
        }
      ],
      "organizations": [],
      "orgs": [],
      "tenants": []
    },
    "share": {
      "id": 21,
      "hash": "SB2330B099E73DA0832D8BC795D1CAB79",
      "options": {},
      "objectType": "survey",
      "objectId": 29,
      "createdBy": 2,
      "createdAt": "2023-08-10 17:42:39",
      "isDelete": false,
      "title": "新建一个演示一下",
      "enable": true
    },
    "isPlatformData": false
  },
  "chartDataStartTimeMillis": 0
}

1.9.2. 返回结果

状态码状态码含义说明数据模型
200OK成功Inline

1.9.3. 返回数据结构

状态码 200

名称类型必选约束中文名说明
» versionstringtruenonenone
» codeintegertruenonenone
» msgstringtruenonenone
» dataobjecttruenonenone
»» titlestringtruenonenone
»» statusstringtruenonenone
»» allowUsersobjecttruenonenone
»»» grantors[object]truenonenone
»»»» idintegerfalsenonenone
»»»» actionstringfalsenonenone
»»»» emailstringfalsenonenone
»»»» namestringfalsenonenone
»»» organizations[string]truenonenone
»»» orgs[string]truenonenone
»»» tenants[string]truenonenone
»» shareobjecttruenone共享链接配置信息
»»» idintegertruenonenone
»»» hashstringtruenonenone
»»» optionsobjecttruenonenone
»»» objectTypestringtruenonenone
»»» objectIdintegertruenonenone
»»» createdByintegertruenonenone
»»» createdAtstringtruenonenone
»»» isDeletebooleantruenonenone
»»» titlestringtruenonenone
»»» enablebooleantruenonenone
»» isPlatformDatabooleantruenone是否为平台数据
» chartDataStartTimeMillisintegertruenonenone

1.10. PUT 修改填报模设置

修改填报模板额外设置信息。

http
PUT /api/surveys/{id}/setting HTTP/1.1
Content-Type: application/json
Cookie: csrf=183f1c4...; sid=26ee552d...; _USER_SESSION_ID=f2a01083...

// Request Body:
{
  "status": "OPEN",
  "allowUsers": {
    "grantors": [
      {
        "id": 17,
        "action": "read",
        "email": "jyuser@qq.com",
        "name": "jyuser"
      }
    ],
    "organizations": [],
    "orgs": [],
    "tenants": []
  }
}

1.10.1. 请求参数

名称位置类型必选说明
idpathintegernone
bodybodyobjectnone
» allowUsersbodyobject允许填报的用户配置信息
»» grantorsbody[object]none
»»» idbodyintegernone
»»» namebodystringnone
»»» actionbodystringnone
»»» emailbodystringnone
»» organizationsbody[string]none
»» orgsbody[string]none
»» tenantsbody[string]none
» statusbodystring填报开启状态

返回示例

http
HTTP/1.1 200 Ok
Content-Type: application/json

{
  "version": "version@9a5e106#6730f0d",
  "code": 0,
  "msg": "success",
  "data": {
    "id": 29,
    "status": "OPEN",
    "allowUsers": {
      "grantors": [
        {
          "id": 17,
          "action": "read",
          "email": "jyuser@qq.com",
          "name": "jyuser"
        }
      ],
      "organizations": [],
      "orgs": [],
      "tenants": []
    }
  },
  "chartDataStartTimeMillis": 0
}

1.10.2. 返回结果

状态码状态码含义说明数据模型
200OK成功Inline

1.10.3. 返回数据结构

1.11. PUT 开启共享链接

http
PUT /api/shares/switch HTTP/1.1
Content-Type: application/json
Cookie: csrf=183f1c4...; sid=26ee552d...; _USER_SESSION_ID=f2a01083...

// Request Body:
{
  "enable": true,
  "objectId": 0,
  "objectType": "string"
}

1.11.1. 请求参数

名称位置类型必选说明
X-CSRF-Tokenheaderstringnone
Cookieheaderstringnone
bodybodyobjectnone
» enablebodybooleannone
» objectIdbodyintegernone
» objectTypebodystringnone

1.11.2. 返回结果

状态码状态码含义说明数据模型
200OK成功Inline

1.11.3. 返回数据结构

1.12. POST 创建填报模板副本

http
POST /api/surveys/{id}/duplicate HTTP/1.1
Content-Type: application/json
Cookie: csrf=183f1c4...; sid=26ee552d...; _USER_SESSION_ID=f2a01083...

使用提供的标题创建指定模板的副本

1.12.1. 请求参数

名称位置类型必选说明
idpathstringnone
newTitlequerystringnone

返回示例

http
HTTP/1.1 200 Ok
Content-Type: application/json

{
  "version": "version@9a5e106#6730f0d",
  "code": 0,
  "msg": "success",
  "data": {
    "id": 32,
    "title": "创建一个副本试试",
    "formTitle": "一个表单",
    "status": "CLOSED",
    "createdBy": 2,
    "createdAt": "2023-08-10 18:35:15",
    "updatedBy": 2,
    "updatedAt": "2023-08-10 18:35:15",
    "options": {
      "submitButton": {
        "title": "提交"
      },
      "resetButton": {
        "title": "重制",
        "enable": true
      },
      "canUpdateData": true,
      "canLookupData": true,
      "canImportData": true,
      "version": 4.4
    },
    "controls": [
      {
        "uuid": "01H7FBCSERDZJG59S52TKJTQ7K",
        "inputType": "singleLineText",
        "title": "你叫什么呀",
        "fieldName": "name",
        "required": true,
        "options": {
          "maxLength": 10,
          "placeholder": "输入姓名"
        }
      },
      {
        "uuid": "01H7FBE8TNVNJ0257YSPQMNNJF",
        "inputType": "numberInput",
        "title": "年龄多少",
        "fieldName": "age",
        "required": false,
        "options": {
          "maxValue": 100,
          "minValue": 0,
          "onlyInteger": true,
          "placeholder": "输入数字好吗"
        }
      }
    ]
  },
  "chartDataStartTimeMillis": 0
}

1.12.2. 返回结果

状态码状态码含义说明数据模型
200OK成功Inline

1.12.3. 返回数据结构

1.13. PUT 更新填写的数据

更新历史填写的数据。

http
PUT /api/surveys/{id}/update HTTP/1.1
Content-Type: application/json
Cookie: csrf=183f1c4...; sid=26ee552d...; _USER_SESSION_ID=f2a01083...

// Request Body:
{
  "01GVM95QGK47SVZWCDJ8SBJWWZ": "xxxxx",
  "01GVMMR5ZAAT8SHYTXQY3MKJDS": "没有手机",
  "01GVMMSXNPQJMRMAQTX8H7VWET": "10212424@qq.com",
  "01GVMMT2YAPQ2FS56GYEMRM0K9": "0745-2110111",
  "uniqueKey": "64ed21f217204bba8d5163076ac56619"
}

1.13.1. 请求参数

名称位置类型必选说明
idpathstringnone
bodybodyobjectnone
» 01GVMMT2YAPQ2FS56GYEMRM0K9bodystring普通控件填写内容键值对
» uniqueKeybodystring当前数据记录的唯一标识(hs_row_id的值)

返回示例

http
HTTP/1.1 200 Ok
Content-Type: application/json

{
  "version": "version@9a5e106#6730f0d",
  "code": 0,
  "msg": "success",
  "chartDataStartTimeMillis": 0
}

1.13.2. 返回结果

状态码状态码含义说明数据模型
200OK成功Inline

1.13.3. 返回数据结构

1.14. DELETE 删除填写的数据

删除历史填写的数据。

http
DELETE /api/surveys/{id}/delete HTTP/1.1
Content-Type: application/json
Cookie: csrf=183f1c4...; sid=26ee552d...; _USER_SESSION_ID=f2a01083...

// Request Body:
[
  "c435f5029fb940abb20cac9fdb3abfc5",
  "86cd0e76dcd345ccb3f08fc6f39d9783"
]

1.14.1. 请求参数

名称位置类型必选说明
idpathstringnone
Cookieheaderstringnone
X-CSRF-Tokenheaderstringnone
bodybodyarray[string]none

返回示例

http
HTTP/1.1 200 Ok
Content-Type: application/json

{
  "version": "version@9a5e106#6730f0d",
  "code": 0,
  "msg": "success",
  "chartDataStartTimeMillis": 0
}

1.14.2. 返回结果

状态码状态码含义说明数据模型
200OK成功Inline

1.14.3. 返回数据结构

1.15. POST 根据条件查询填写的表单数据

根据条件查询填写的表单数据。条件以HE的方式传入,具体参考HE部分。

http
POST /api/surveys/{id}/query HTTP/1.1
Content-Type: application/json
Cookie: csrf=183f1c4...; sid=26ee552d...; _USER_SESSION_ID=f2a01083...

// Request Body:
{
  "kind": "function",
  "op": "select_fields",
  "args": [
    {
      "kind": "function",
      "op": "filter",
      "args": [
        {
          "kind": "dataset",
          "op": "29"
        },
        {
          "kind": "function",
          "op": "and",
          "args": [
            {
              "kind": "function",
              "op": "!=",
              "args": [
                {
                  "kind": "field",
                  "op": "name",
                  "type": "string",
                  "args": [
                    "[Object]"
                  ]
                },
                {
                  "kind": "constant",
                  "op": "0",
                  "type": "string"
                }
              ]
            }
          ]
        }
      ]
    },
    {
      "kind": "field",
      "op": "name",
      "uid": "name"
    },
    {
      "kind": "field",
      "op": "age",
      "uid": "age"
    },
    {
      "kind": "field",
      "op": "hs_updater_id",
      "uid": "hs_updater_id"
    },
    {
      "kind": "field",
      "op": "hs_updater_company",
      "uid": "hs_updater_company"
    },
    {
      "kind": "field",
      "op": "hs_update_time",
      "uid": "hs_update_time"
    },
    {
      "kind": "field",
      "op": "hs_user_id",
      "uid": "hs_user_id"
    },
    {
      "kind": "field",
      "op": "hs_user_company",
      "uid": "hs_user_company"
    },
    {
      "kind": "field",
      "op": "hs_create_time",
      "uid": "hs_create_time"
    },
    {
      "kind": "field",
      "op": "hs_row_id",
      "uid": "hs_row_id"
    }
  ]
}

1.15.1. 请求参数

名称位置类型必选说明
idpathstringnone
offsetqueryintegernone
limitqueryintegernone
totalRequiredquerystringnone
bodybodyobjectnone

返回示例

http
HTTP/1.1 200 Ok
Content-Type: application/json

{
  "version": "version@9a5e106#6730f0d",
  "code": 0,
  "msg": "success",
  "data": {
    "data": [
      [
        "你的名字",
        32,
        2,
        null,
        "2023-08-10 17:58:58.000",
        2,
        null,
        "2023-08-10 17:58:58.000",
        "a5048bef2ee54b2bbe83f80f90783a0c"
      ],
      [
        "你的名字",
        32,
        2,
        null,
        "2023-08-10 18:02:09.000",
        2,
        null,
        "2023-08-10 18:02:09.000",
        "c435f5029fb940abb20cac9fdb3abfc5"
      ],
      [
        "as da",
        null,
        2,
        null,
        "2023-08-10 18:05:23.000",
        2,
        null,
        "2023-08-10 18:05:23.000",
        "86cd0e76dcd345ccb3f08fc6f39d9783"
      ]
    ],
    "mapData": [],
    "schema": [
      {
        "fieldName": "name",
        "tags": {},
        "defaultAggrType": "count",
        "basicType": "string",
        "suggestedTypes": [
          "string"
        ],
        "hideValue": false,
        "nativeType": "LONGTEXT",
        "originType": "string",
        "oriName": "01H7FBCSERDZJG59S52TKJTQ7K",
        "visible": true,
        "config": {},
        "type": "string",
        "label": "你叫什么呀",
        "comment": "你叫什么呀"
      },
      {
        "fieldName": "age",
        "tags": {},
        "defaultAggrType": "sum",
        "basicType": "number",
        "suggestedTypes": [
          "number"
        ],
        "hideValue": false,
        "nativeType": "NUMERIC(65,10)",
        "originType": "number",
        "oriName": "01H7FBE8TNVNJ0257YSPQMNNJF",
        "visible": true,
        "config": {},
        "type": "number",
        "label": "年龄多少",
        "comment": "年龄多少"
      },
      {
        "fieldName": "hs_updater_id",
        "tags": {},
        "defaultAggrType": "sum",
        "basicType": "number",
        "suggestedTypes": [
          "number"
        ],
        "hideValue": false,
        "originType": "integer",
        "visible": true,
        "config": {},
        "type": "number"
      },
      {
        "fieldName": "hs_updater_company",
        "tags": {},
        "defaultAggrType": "sum",
        "basicType": "number",
        "suggestedTypes": [
          "number"
        ],
        "hideValue": false,
        "originType": "integer",
        "visible": true,
        "config": {},
        "type": "number"
      },
      {
        "fieldName": "hs_update_time",
        "tags": {},
        "defaultAggrType": "year",
        "basicType": "date",
        "suggestedTypes": [
          "date"
        ],
        "hideValue": false,
        "originType": "time",
        "visible": true,
        "config": {},
        "type": "date"
      },
      {
        "fieldName": "hs_user_id",
        "tags": {},
        "defaultAggrType": "sum",
        "basicType": "number",
        "suggestedTypes": [
          "number"
        ],
        "hideValue": false,
        "originType": "integer",
        "visible": true,
        "config": {},
        "type": "number"
      },
      {
        "fieldName": "hs_user_company",
        "tags": {},
        "defaultAggrType": "sum",
        "basicType": "number",
        "suggestedTypes": [
          "number"
        ],
        "hideValue": false,
        "originType": "integer",
        "visible": true,
        "config": {},
        "type": "number"
      },
      {
        "fieldName": "hs_create_time",
        "tags": {},
        "defaultAggrType": "year",
        "basicType": "date",
        "suggestedTypes": [
          "date"
        ],
        "hideValue": false,
        "originType": "time",
        "visible": true,
        "config": {},
        "type": "date"
      },
      {
        "fieldName": "hs_row_id",
        "tags": {},
        "defaultAggrType": "count",
        "basicType": "string",
        "suggestedTypes": [
          "string"
        ],
        "hideValue": false,
        "originType": "string",
        "visible": true,
        "config": {},
        "type": "string"
      }
    ],
    "pagable": true,
    "importSwitchable": true,
    "totalHits": 3
  },
  "chartDataStartTimeMillis": 0
}

1.15.2. 返回结果

状态码状态码含义说明数据模型
200OK成功Inline

1.15.3. 返回数据结构

1.16. GET 下载模板

http
GET /api/surveys/{id}/async-download-template HTTP/1.1
Accept: application/json
Cookie: csrf=183f1c4...; sid=26ee552d...; _USER_SESSION_ID=f2a01083...

下载填报表单的导入模板。

1.16.1. 请求参数

名称位置类型必选说明
idpathstringnone
withDataquerystring是否携带历史填写的数据

返回示例

http
HTTP/1.1 200 Ok
Content-Type: application/json

{}

1.16.2. 返回结果

状态码状态码含义说明数据模型
200OK成功Inline

1.16.3. 返回数据结构

1.17. POST 导入数据(填报管理员)

批量导入数据的API。该API仅供模板管理员调用(目前仅支持模板创建者调用)。接受xlsx,xls,csv格式文件。

http
POST /api/surveys/{id}/import HTTP/1.1
Content-Type: multipart/form-data; boundary=----WebKitFormBoundaryK1u6TkSMwt8ok9vT
Cookie: csrf=183f1c4...; sid=26ee552d...; _USER_SESSION_ID=f2a01083...

file:
------WebKitFormBoundaryK1u6TkSMwt8ok9vT
Content-Disposition: form-data; name="file"; filename="test.csv"
Content-Type: text/csv
------WebKitFormBoundaryK1u6TkSMwt8ok9vT--

1.17.1. 请求参数

名称位置类型必选说明
idpathstringnone
bodybodyobjectnone
» filebodystring(binary)要导入的文件

返回示例

http
HTTP/1.1 200 Ok
Content-Type: application/json

{
  "version": "string",
  "code": 0,
  "msg": "string",
  "error": "string",
  "data": {
    "fileInfo": {
      "fileId": "string",
      "type": "string",
      "sheetList": [
        "string"
      ],
      "originalFilename": "string",
      "fileExtension": "string"
    }
  },
  "chartDataStartTimeMillis": 0
}
http
HTTP/1.1 400 Bad Request
Content-Type: application/json

{
  "version": "version@9a5e106#6730f0d",
  "code": 10321,
  "msg": "文件内容存在错误",
  "error": "error/survey-file-content-contains-error",
  "data": {
    "fileInfo": {
      "fileId": "94",
      "type": "file_excel",
      "sheetList": [],
      "originalFilename": "新建一个演示一下 2023-08-10 18-59-08.xlsx",
      "fileExtension": ".xlsx"
    }
  },
  "chartDataStartTimeMillis": 0
}

1.17.2. 返回结果

状态码状态码含义说明数据模型
200OK成功Inline
400Bad Request文件内容存在错误Inline

1.17.3. 返回数据结构

状态码 400

名称类型必选约束中文名说明
» versionstringtruenonenone
» codeintegertruenonenone
» msgstringtruenonenone
» errorstringtruenonenone
» dataobjecttruenonenone
»» fileInfoobjecttruenone文件信息
»»» fileIdstringtruenone文件id
»»» typestringtruenone文件类型
»»» sheetList[string]truenonenone
»»» originalFilenamestringtruenone原始文件名
»»» fileExtensionstringtruenone文件扩展名
» chartDataStartTimeMillisintegertruenonenone

1.18. GET 获取导入数据失败的错误提示文件(填报管理员)

http
GET /api/surveys/{id}/async-download-import-error HTTP/1.1
Accept: application/json
Cookie: csrf=183f1c4...; sid=26ee552d...; _USER_SESSION_ID=f2a01083...

当批量导入数据失败时,可使用该API获取导入过程中出现的与填写的数据有关的错误。该API仅供模板管理员调用。(目前仅支持模板创建者调用)

1.18.1. 请求参数

名称位置类型必选说明
idpathstringnone
fileIdquerystring文件id(导入API返回的文件id)
originTypequerystring原始文件类型
requestIdquerystring请求id
bodybodyobjectnone

1.18.2. 返回结果

状态码状态码含义说明数据模型
200OK成功Inline

1.18.3. 返回数据结构

1.19. GET 异步请求下载文件

http
GET /api/surveys/{id}/poll-download HTTP/1.1
Accept: application/json
Cookie: csrf=183f1c4...; sid=26ee552d...; _USER_SESSION_ID=f2a01083...

根据requestId下载异步导出的文件。

1.19.1. 请求参数

名称位置类型必选说明
idpathstring填报模板id
originRequestIdquerystring发起导出/下载请求的请求id
bodybodyobjectnone

1.19.2. 返回结果

状态码状态码含义说明数据模型
200OK成功Inline

1.19.3. 返回数据结构

1.20. GET 租户查询平台授权模板列表

http
GET /api/surveys/platform HTTP/1.1
Accept: application/json
Cookie: csrf=183f1c4...; sid=26ee552d...; _USER_SESSION_ID=f2a01083...

租户方查询平台方授权给自己的填报模板列表。

1.20.1. 返回结果

状态码状态码含义说明数据模型
200OK成功Inline

1.20.2. 返回数据结构

1.21. POST 导出数据(填报管理员)

提供给填报管理员导出数据的API,该API仅对填报模板有管理权限的用户能够调用(目前仅支持填报模板的创建者调用)。可提供HE表达式对要进行导出的数据进行过滤。

http
POST /api/surveys/29/async-download-data HTTP/1.1
Content-Type: application/json
Cookie: csrf=183f1c4...; sid=26ee552d...; _USER_SESSION_ID=f2a01083...

// Request Body:
{
  "kind": "function",
  "op": "select_fields",
  "args": [
    {
      "kind": "function",
      "op": "filter",
      "args": [
        {
          "kind": "dataset",
          "op": "29"
        },
        {
          "kind": "function",
          "op": "and",
          "args": [
            {
              "kind": "function",
              "op": "!=",
              "args": [
                {
                  "kind": "field",
                  "op": "name",
                  "type": "string",
                  "args": [
                    "[Object]"
                  ]
                },
                {
                  "kind": "constant",
                  "op": "123",
                  "type": "string"
                }
              ]
            }
          ]
        }
      ]
    },
    {
      "kind": "field",
      "op": "name",
      "uid": "name"
    },
    {
      "kind": "field",
      "op": "age",
      "uid": "age"
    },
    {
      "kind": "field",
      "op": "hs_updater_id",
      "uid": "hs_updater_id"
    },
    {
      "kind": "field",
      "op": "hs_updater_company",
      "uid": "hs_updater_company"
    },
    {
      "kind": "field",
      "op": "hs_update_time",
      "uid": "hs_update_time"
    },
    {
      "kind": "field",
      "op": "hs_user_id",
      "uid": "hs_user_id"
    },
    {
      "kind": "field",
      "op": "hs_user_company",
      "uid": "hs_user_company"
    },
    {
      "kind": "field",
      "op": "hs_create_time",
      "uid": "hs_create_time"
    },
    {
      "kind": "field",
      "op": "hs_row_id",
      "uid": "hs_row_id"
    }
  ]
}

1.21.1. 请求参数

名称位置类型必选说明
timeoutqueryinteger等待超时时间(单位毫秒)。当设置该参数时,接口将会等待指定时间再返回,如果在指定时间内没有成功导出,需要使用异步请求下载文件接口进行尝试获取导出文件。
requestIdquerystring当前请求的id
bodybodyobjectnone

1.21.2. 返回结果

状态码状态码含义说明数据模型
200OK成功Inline

1.21.3. 返回数据结构

1.22. POST 导入数据

批量导入数据的API。接受xlsx,xls,csv格式文件。

http
POST /api/surveys/{id}/submit-file HTTP/1.1
Content-Type: multipart/form-data; boundary=----WebKitFormBoundaryK1u6TkSMwt8ok9vT
Cookie: csrf=183f1c4...; sid=26ee552d...; _USER_SESSION_ID=f2a01083...

file:
------WebKitFormBoundaryK1u6TkSMwt8ok9vT
Content-Disposition: form-data; name="file"; filename="小数.csv"
Content-Type: text/csv
------WebKitFormBoundaryK1u6TkSMwt8ok9vT--

1.22.1. 请求参数

名称位置类型必选说明
idpathstringnone
bodybodyobjectnone
» filebodystring(binary)要导入的文件

返回示例

http
HTTP/1.1 200 Ok
Content-Type: application/json

{
  "version": "string",
  "code": 0,
  "msg": "string",
  "error": "string",
  "data": {
    "fileInfo": {
      "fileId": "string",
      "type": "string",
      "sheetList": [
        "string"
      ],
      "originalFilename": "string",
      "fileExtension": "string"
    }
  },
  "chartDataStartTimeMillis": 0
}
http
HTTP/1.1 400 Bad Request
Content-Type: application/json

{
  "version": "version@9a5e106#6730f0d",
  "code": 10321,
  "msg": "文件内容存在错误",
  "error": "error/survey-file-content-contains-error",
  "data": {
    "fileInfo": {
      "fileId": "94",
      "type": "file_excel",
      "sheetList": [],
      "originalFilename": "新建一个演示一下 2023-08-10 18-59-08.xlsx",
      "fileExtension": ".xlsx"
    }
  },
  "chartDataStartTimeMillis": 0
}

1.22.2. 返回结果

状态码状态码含义说明数据模型
200OK成功Inline
400Bad Request文件内容存在错误Inline

1.22.3. 返回数据结构

状态码 400

名称类型必选约束中文名说明
» versionstringtruenonenone
» codeintegertruenonenone
» msgstringtruenonenone
» errorstringtruenonenone
» dataobjecttruenonenone
»» fileInfoobjecttruenone文件信息
»»» fileIdstringtruenone文件id
»»» typestringtruenone文件类型
»»» sheetList[string]truenonenone
»»» originalFilenamestringtruenone原始文件名
»»» fileExtensionstringtruenone文件扩展名
» chartDataStartTimeMillisintegertruenonenone

1.23. GET 获取导入数据失败的错误提示文件

http
GET /api/surveys/{id}/async-download-submit-error HTTP/1.1
Accept: application/json
Cookie: csrf=183f1c4...; sid=26ee552d...; _USER_SESSION_ID=f2a01083...

当批量导入数据失败时,可使用该API获取导入过程中出现的与填写的数据有关的错误。

1.23.1. 请求参数

名称位置类型必选说明
idpathstringnone
fileIdquerystring文件id(导入API返回的文件id)
originTypequerystring原始文件类型
requestIdquerystring请求id
bodybodyobjectnone

1.23.2. 返回结果

状态码状态码含义说明数据模型
200OK成功Inline

1.23.3. 返回数据结构

2. 数据模型

HENGSHI SENSE API 使用手册