创建表单

您所在的位置:网站首页 如何建立金山表单 创建表单

创建表单

2024-07-08 19:50:32| 来源: 网络整理| 查看: 265

创建表单 #

注意

表单相关接口目前处于 alpha 阶段,接口可能会随时调整,请慎重使用。

创建金山文档表单

基本信息 #

请求方法:POST

请求路径:/api/v1/openapi/personal/forms

请求主机:developer.kdocs.cn

限流频次 #应用类型限额测试应用500 次/天正式应用100,000 次/天权限范围 #权限值显示名称权限说明create_form创建表单创建表单Path 参数 #参数必须类型说明form_id是string表单 idQuery 参数 #参数必须类型说明access_token是string访问令牌Body 参数 #参数必须类型说明title是string表单标题subtitle否string表单副标题+config否formConfig {}表单设置+varied_config否variedConfig {}表单可拓展设置(包含群投票相关配置)vote_show_time否投票结果显示时间beforeVote 投票前即显示当前投票结果,afterVote 投票结束后显示结果,notShow 不显示投票结果is_vote否boolean是否群投票应用(投票应用固定传true)is_not_write_execl否boolean是否不写表格(投票应用固定传true)information_fill_notify否boolean有人填写的时候通知表单创建者channel_share否string[]分享渠道标识check_login否boolean是否填写者必须登录金山文档才能填写check_once否boolean是否只能填写一次can_secret_vote否boolean是否可以匿名投票expire否integer表单有效期,单位为毫秒,另有两个特殊值:0 永久有效,-1 设置表单已经过期hidden否boolean是否在表单列表隐藏当前创建的表单(投票类型的表单传 true)+answer_items否answerItems {}表单结束语设置closing_remark_text否表单填写结束语内容+questions是questions {}表单题目id是string题目 IDquestion是题目内容+questions_sections否questionSections {}表单题目id是string题目 ID+questions是questionSection题目内容qid是string题目 ID

提示

questions 为一个 map,key 为题目 ID,value 为题目内容。

提示

question_sections 为一个对象数组,用来控制表单的展现形式的,尤其注意可以用来控制表单中题目的展示顺序。可以将所有要显示的题目按照顺序,放到一个 question_sections 内部。以下为一个示例:

{ // 表单内的其它数据先省略,其它字段省略 "question_sections": [ { "id": "question_section_id", "questions": [ { "qid": "question_id_1", }, { "qid": "question_id_2", } // 将所有要显示的题目,delete = false 的,都放到这一个元素内 ] } ] } 开放平台提供的题目类型及格式定义如下: #

提示

questions 为一个 map,key 为题目 ID,value 为题目内容。

此处仅列举 question 即 value 部分

不同题型通过 type 字段来标识

填空题类 #

填空类题目包含如下类型 type:

input单行填空题-单行填空

multiInput 多行填空题-多行填空

floatInput 数字填空题-数字

telphone 填空题-手机号手机号

star 评分题

date 填空题-日期日期

time 时间填空题-时间

signatures 填空题-电子签名电子签名

idcard:填空题-身份证号

email邮箱填空题-邮箱

scanCode 填空题-扫码输入扫码输入

multiStepInput 多段填空___第二空___

address填空题-地址地址

参数格式:

参数必须类型说明title是string题目标题type是string题目类型,示例: input 填空题need否boolean是否必答hidden否boolean是否隐藏

示例:

{ "questions": { "3t56gf": { "title": "填空题-单行填空", "type": "input", "need": true, "hidden": false, "delete": false } } } 选择题类 #

select 选择题-单选题

doubleSelect 多选选择题

pullSelect 选择题-下拉题子问题

multiSelect 选择题-多段选择

参数格式:

参数必须类型说明title是string题目标题type是string题目类型,示例: input 填空题need否boolean是否必答hidden否boolean是否隐藏+selects是selects[]选项列表itemId是string选项 IDtext是string选项内容

请求示例:

{ "questions": { "2agiq4": { "title": "选择题-多选题", "type": "doubleSelect", "need": false, "hidden": false, "delete": false, "selects": [ { "itemId": "k17j6v", "text": "11" }, { "itemId": "i4ijyw", "text": "22" } ] } } } 附件类 #

file 上传单个附件

multiFile 上传多份附件

newImage 上传单张图片

newMultiImage 上传多张图片

参数格式:

参数必须类型说明title是string题目标题type是string题目类型,示例: input 填空题need否boolean是否必答hidden否boolean是否隐藏fileSizeLimit否integer附件大小限制fileAcceptType否string[]附件类型约束,示例:["word", "image"]+subItems是subItems[]附件子项列表itemId是stringIDtext是string子项内容sort否integer子项顺序号

请求示例:

{ "questions": { "7nfwow": { "title": "图片题-单张", "type": "newImage", "need": false, "delete": false, "subItems": [ { "itemId": "la0sol", "sort": 1, "text": "图片1" } ], "fileAcceptType": null, "fileSizeLimit": 100 } } } 量表题类 #

scale 量表题

matrixScale 矩阵量表题

参数格式:

参数必须类型说明title是string题目标题type是string题目类型,示例: input 填空题need否boolean是否必答hidden否boolean是否隐藏+subItems是scaleSubItems[]量表选项列表itemId是stringIDtext是string选项内容sort否integer选项顺序号+scaleSelects是scaleSelects[]选项内容定义itemId是stringIDtext是string子项内容

请求示例:

{ "questions": { "v45ovc": { "title": "矩阵量表题", "type": "matrixScale", "need": false, "delete": false, "subItems": [ { "itemId": "fapyqz", "sort": 0, "text": "子标题1", "scaleSelects": [ { "itemId": "z7978q", "text": "1", }, { "itemId": "p32a9g", "text": "2", }, { "itemId": "fxa687", "text": "3", }, { "itemId": "1g1m8d", "text": "4", }, { "itemId": "8yopc0", "text": "5", } ], "checkStatus": 0 }, { "itemId": "i7vcug", "sort": 1, "text": "子标题2", "scaleSelects": [ { "itemId": "p77jax", "text": "1", }, { "itemId": "svak5x", "text": "2", }, { "itemId": "silc52", "text": "3", }, { "itemId": "49ig0h", "text": "4", }, { "itemId": "zzt2jw", "text": "5", } ], "checkStatus": 0 } ] } } } 返回参数 #参数必须类型说明code是integer错误码+data是data {}响应数据+id是id {}表单 idopen_idstring文档或用户在一个应用下的唯一标识,详情请参见 open_idunion_idstring文档或用户在一个服务商下的唯一标识,详情请参见 union_idsuper_token是string表单的 Token,用于匿名填写表单示例 #请求示例 #curl --request POST \ --url 'https://developer.kdocs.cn/api/v1/openapi/personal/forms?access_token=kvqxrspxjctdojjqdildjhonzwusaquc' \ --header 'Content-Type: application/json' \ --data '{"title":"interaction_vote","config":{"varied_config":{"vote_show_time":"","is_vote":true,"is_not_write_excel":true,"information_fill_notify":false},"check_login":false,"check_once":false,"can_secret_vote":false,"expire":0},"hidden":false,"questions":{"1855622480":{"id":"1855622480","title":"123","type":"select","selects":[{"itemId":"1","text":"1"},{"itemId":"2","text":"2"}],"need":true,"hidden":false}},"answer_items":{"closing_remark_text":""},"subtitle":""}' OkHttpClient client = new OkHttpClient(); MediaType mediaType = MediaType.parse("application/json"); RequestBody body = RequestBody.create(mediaType, "{\"title\":\"interaction_vote\",\"config\":{\"varied_config\":{\"vote_show_time\":\"\",\"is_vote\":true,\"is_not_write_excel\":true,\"information_fill_notify\":false},\"check_login\":false,\"check_once\":false,\"can_secret_vote\":false,\"expire\":0},\"hidden\":false,\"questions\":{\"1855622480\":{\"id\":\"1855622480\",\"title\":\"123\",\"type\":\"select\",\"selects\":[{\"itemId\":\"1\",\"text\":\"1\"},{\"itemId\":\"2\",\"text\":\"2\"}],\"need\":true,\"hidden\":false}},\"answer_items\":{\"closing_remark_text\":\"\"},\"subtitle\":\"\"}"); Request request = new Request.Builder() .url("https://developer.kdocs.cn/api/v1/openapi/personal/forms?access_token=kvqxrspxjctdojjqdildjhonzwusaquc") .post(body) .addHeader("Content-Type", "application/json") .build(); Response response = client.newCall(request).execute(); package main import ( "fmt" "strings" "net/http" "io/ioutil" ) func main() { url := "https://developer.kdocs.cn/api/v1/openapi/personal/forms?access_token=kvqxrspxjctdojjqdildjhonzwusaquc" payload := strings.NewReader("{\"title\":\"interaction_vote\",\"config\":{\"varied_config\":{\"vote_show_time\":\"\",\"is_vote\":true,\"is_not_write_excel\":true,\"information_fill_notify\":false},\"check_login\":false,\"check_once\":false,\"can_secret_vote\":false,\"expire\":0},\"hidden\":false,\"questions\":{\"1855622480\":{\"id\":\"1855622480\",\"title\":\"123\",\"type\":\"select\",\"selects\":[{\"itemId\":\"1\",\"text\":\"1\"},{\"itemId\":\"2\",\"text\":\"2\"}],\"need\":true,\"hidden\":false}},\"answer_items\":{\"closing_remark_text\":\"\"},\"subtitle\":\"\"}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := ioutil.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } import http.client conn = http.client.HTTPSConnection("developer.kdocs.cn") payload = "{\"title\":\"interaction_vote\",\"config\":{\"varied_config\":{\"vote_show_time\":\"\",\"is_vote\":true,\"is_not_write_excel\":true,\"information_fill_notify\":false},\"check_login\":false,\"check_once\":false,\"can_secret_vote\":false,\"expire\":0},\"hidden\":false,\"questions\":{\"1855622480\":{\"id\":\"1855622480\",\"title\":\"123\",\"type\":\"select\",\"selects\":[{\"itemId\":\"1\",\"text\":\"1\"},{\"itemId\":\"2\",\"text\":\"2\"}],\"need\":true,\"hidden\":false}},\"answer_items\":{\"closing_remark_text\":\"\"},\"subtitle\":\"\"}" headers = { 'Content-Type': "application/json" } conn.request("POST", "/api/v1/openapi/personal/forms?access_token=kvqxrspxjctdojjqdildjhonzwusaquc", payload, headers) res = conn.getresponse() data = res.read() print(data.decode("utf-8"))


【本文地址】

公司简介

联系我们

今日新闻


点击排行

实验室常用的仪器、试剂和
说到实验室常用到的东西,主要就分为仪器、试剂和耗
不用再找了,全球10大实验
01、赛默飞世尔科技(热电)Thermo Fisher Scientif
三代水柜的量产巅峰T-72坦
作者:寞寒最近,西边闹腾挺大,本来小寞以为忙完这
通风柜跟实验室通风系统有
说到通风柜跟实验室通风,不少人都纠结二者到底是不
集消毒杀菌、烘干收纳为一
厨房是家里细菌较多的地方,潮湿的环境、没有完全密
实验室设备之全钢实验台如
全钢实验台是实验室家具中较为重要的家具之一,很多

推荐新闻


图片新闻

实验室药品柜的特性有哪些
实验室药品柜是实验室家具的重要组成部分之一,主要
小学科学实验中有哪些教学
计算机 计算器 一般 打孔器 打气筒 仪器车 显微镜
实验室各种仪器原理动图讲
1.紫外分光光谱UV分析原理:吸收紫外光能量,引起分
高中化学常见仪器及实验装
1、可加热仪器:2、计量仪器:(1)仪器A的名称:量
微生物操作主要设备和器具
今天盘点一下微生物操作主要设备和器具,别嫌我啰嗦
浅谈通风柜使用基本常识
 众所周知,通风柜功能中最主要的就是排气功能。在

专题文章

    CopyRight 2018-2019 实验室设备网 版权所有 win10的实时保护怎么永久关闭