金数据帮助中心

表单 API

目录

正文

首先确保你有访问 API 的能力。获得 API Key & Secret 后,即可后续操作。

一、获取账户下所有表单 token 、 表单名 、表单标签

  • 表单 token 是每个表单的识别条件,快速获取每个账户下创建的所有表单token和表单名称
  • 每次只能返回 50个 表单 token、表单名称、表单标签
  • 最近 50 个创建的表单获取方法
    • 请求地址:https://jinshuju.net/api/v1/forms
    • 请求方法:GET
    • 代码示例(python)
    import requests
        url = "https://jinshuju.net/api/v1/forms"
        payload={}
        headers = {
        'Authorization': 'Basic TE8tZzYyWHZDbTJTSDZKQ05mNkRHZzpjbm54UFJx78jg2973k917ndc9vfe6'
        }
        response = requests.request("GET", url, headers=headers, data=payload)
        print(response.text)

返回示例

返回参数说明

  • total :账户下创建表单总数
  • count:返回的表单个数
  • name:表单名称
  • token:表单的唯一标识,实际返回没有*号
  • next :可用户获取最近创建的第50个之后的所有表单token和表单名称
    {
        "total": 1011,
        "count": 50,
        "data": [
            {
                "name": "测试",
                "token": "D123Vi",
                "tags": []
            },
                ...
            {
                "name": "未命名表单",
                "token": "G123py",
                "tags": []
            }
        ],
        "next": "60c1806a6194e2f320e3bbcd"
    }

超过 50 个表单的获取方法,以 Python 为例

  • 请求地址:https://jinshuju.net/api/v1/forms??next= next
  • 请求方法:GET
  • 代码示例(python)
    import requests
        url = "https://jinshuju.net/api/v1/forms?next=60c1806a6194e2f320e3bbcd"
        payload={}
        headers = {
            'Authorization': 'Basic TE8tZzYyWHZDbTJTSDZKQ05mNkRHZzpjbm54UFJx78jg2973k917ndc9vfe6'
        }
        response = requests.request("GET", url, headers=headers, data=payload)
        print(response.text)

二、获取单个表单结构

  • 用于获取表单的结构 Json 定义
    • 请求地址:https://jinshuju.net/api/v1/forms/ token
    • 请求方法:GET
    • 代码示例(Python)
    import requests
        import json
        url = "https://jinshuju.net/api/v1/forms/A1pFWl"
        payload = json.dumps({
        })
        headers = {
        'Accept': 'application/json',
        'Content-Type': 'application/json',
        'Authorization': 'Basic TE8tZzYyWHZDbTJTSDZKQ05mNkRHjyh8ujs875djhzi98xs6zSaWR6a3hJSFhR'
        }
        response = requests.request("GET", url, headers=headers, data=payload)
        print(response.text)

返回示例

返回参数说明

  • type: 字段数据格式类型
  • private: 字段被隐藏
  • validation: 目前开启的字段校验规则
  • value: 每个选项都有一个单独的 value,可用于通过 API 向金数据表单的单选字段推送该选项数
  • operand_value: 设置选项赋值
  • quota: 设置选项名额
  • associated _ form _ token: 表单关联字段关联的表单 token
  • associated _ field _ api _ code: 表单关联字段 关联字段 的 api_code
  • display _ field _ settings: 表单关联字段 展示字段 的 api_code
     {
        "name": "[新]API测试",
        "description": "感谢您能抽出几分钟时间填写以下内容,现在我们马上开始吧!",
        "fields": [
            {
                "field_1": {
                    "label": "",
                    "type": "page_break",
                    "notes": "",
                    "private": false,
                    "validation": {}
                }
            },
            {
                "field_2": {
                    "label": "单行文字",
                    "type": "single_line_text",
                    "notes": "",
                    "private": false,
                    "validation": {
                        "required": true,
                        "unique": true,
                        "white_list_limit": true,
                        "access_control_list_limit": true,
                        "access_control_type": "white",
                        "minimum_length": 1,
                        "maximum_length": 99,
                        "white_list_values": [
                            "这里是字段白名单"
                        ],
                        "acl_values": [
                            "这里是字段白名单"
                        ]
                    }
                }
            },
            {
                "field_3": {
                    "label": "多行文字",
                    "type": "paragraph_text",
                    "notes": "",
                    "private": true,
                    "validation": {}
                }
            },
            {
                "field_4": {
                    "label": "单项选择",
                    "type": "single_choice",
                    "notes": "",
                    "private": false,
                    "validation": {},
                    "choices": [
                        {
                            "name": "单项选项1",
                            "value": "b8OH",
                            "hidden": false,
                            "operand_value": 5.0
                        },
                        {
                            "name": "单项选项2",
                            "value": "Tq87",
                            "hidden": false,
                            "operand_value": 5.0
                        },
                        {
                            "name": "单项选项3",
                            "value": "5Wi0",
                            "hidden": false,
                            "operand_value": 5.0
                        }
                    ],
                    "allow_other": false
                }
            },
            {
                "field_5": {
                    "label": "多项选择",
                    "type": "multiple_choice",
                    "notes": "",
                    "private": false,
                    "validation": {},
                    "choices": [
                        {
                            "name": "多项选项1",
                            "value": "0etl",
                            "hidden": false,
                            "quota": 7
                        },
                        {
                            "name": "多项选项2",
                            "value": "NlAj",
                            "hidden": false,
                            "quota": 7
                        },
                        {
                            "name": "多项选项3",
                            "value": "EOMU",
                            "hidden": false,
                            "quota": 7
                        }
                    ],
                    "allow_other": false
                }
            },
            {
                "field_6": {
                    "label": "图片单选",
                    "type": "multiple_choice",
                    "notes": "",
                    "private": false,
                    "validation": {},
                    "choices": [
                        {
                            "name": "图片单选1",
                            "value": "1WO8",
                            "hidden": false,
                            "image_url": "https://gd-pub.jinshujufiles.com/ic/20210818174042_9f94f7",
                            "large_path": "https://gd-pub.jinshujufiles.com/ic/20210818174042_9f94f7@iclarge"
                        },
                        {
                            "name": "图片单选2",
                            "value": "LXiy",
                            "hidden": false,
                            "image_url": "https://gd-pub.jinshujufiles.com/ic/20210818174042_fa261f",
                            "large_path": "https://gd-pub.jinshujufiles.com/ic/20210818174042_fa261f@iclarge"
                        }
                    ],
                    "allow_other": false
                }
            },
            {
                "field_7": {
                    "label": "图片多选",
                    "type": "multiple_choice",
                    "notes": "",
                    "private": false,
                    "validation": {},
                    "choices": [
                        {
                            "name": "图片多选1",
                            "value": "9eos",
                            "hidden": false,
                            "image_url": "https://gd-pub.jinshujufiles.com/ic/20210818174123_36185c",
                            "large_path": "https://gd-pub.jinshujufiles.com/ic/20210818174123_36185c@iclarge"
                        },
                        {
                            "name": "图片多选2",
                            "value": "uM6l",
                            "hidden": false,
                            "image_url": "https://gd-pub.jinshujufiles.com/ic/20210818174123_7b16ea",
                            "large_path": "https://gd-pub.jinshujufiles.com/ic/20210818174123_7b16ea@iclarge"
                        }
                    ],
                    "allow_other": false
                }
            },
            {
                "field_8": {
                    "label": "数字",
                    "type": "number",
                    "notes": "",
                    "private": false,
                    "validation": {}
                }
            },
            {
                "field_9": {
                    "label": "下拉框",
                    "type": "drop_down",
                    "notes": "",
                    "private": false,
                    "validation": {},
                    "choices": [
                        {
                            "name": "下拉框1",
                            "value": "ScBd",
                            "hidden": false
                        },
                        {
                            "name": "下拉框2",
                            "value": "OTzH",
                            "hidden": false
                        },
                        {
                            "name": "下拉框3",
                            "value": "gylz",
                            "hidden": false
                        }
                    ],
                    "allow_other": false
                }
            },
            {
                "field_10": {
                    "label": "多级下拉框",
                    "type": "cascade_drop_down",
                    "notes": "",
                    "private": false,
                    "validation": {},
                    "choices": [
                        {
                            "name": "多级下拉框一级选项 1",
                            "value": "bAKv",
                            "hidden": false,
                            "sub_choices": [
                                {
                                    "name": "多级下拉框二级选项 1",
                                    "value": "lVAc"
                                },
                                {
                                    "name": "多级下拉框二级选项 2",
                                    "value": "6SCU"
                                }
                            ]
                        },
                        {
                            "name": "多级下拉框一级选项 2",
                            "value": "ybYq",
                            "hidden": false,
                            "sub_choices": [
                                {
                                    "name": "多级下拉框二级选项 1",
                                    "value": "yxzk"
                                },
                                {
                                    "name": "多级下拉框二级选项 2",
                                    "value": "77Oa"
                                }
                            ]
                        }
                    ]
                }
            },
            {
                "field_11": {
                    "label": "数字",
                    "type": "number",
                    "notes": "",
                    "private": false,
                    "validation": {}
                }
            },
            {
                "field_12": {
                    "label": "上传附件",
                    "type": "attachment",
                    "notes": "",
                    "private": false,
                    "validation": {},
                    "max_file_quantity": 1,
                    "media_type": {
                        "type": "unlimited",
                        "value": []
                    }
                }
            },
            {
                "field_13": {
                    "label": "网址",
                    "type": "link",
                    "notes": "",
                    "private": false,
                    "validation": {}
                }
            },
            {
                "field_14": {
                    "label": "地理位置",
                    "type": "geo_location",
                    "notes": "",
                    "private": false,
                    "validation": {}
                }
            },
            {
                "field_15": {
                    "label": "描描述",
                    "type": "section_break",
                    "notes": "请在右侧面板添加段落说明信息",
                    "private": false,
                    "validation": {}
                }
            },
            {
                "field_16": {
                    "label": "分页",
                    "type": "page_break",
                    "notes": "",
                    "private": false,
                    "validation": {}
                }
            },
            {
                "field_17": {
                    "label": "配图商品",
                    "type": "goods",
                    "notes": "",
                    "private": false,
                    "validation": {},
                    "goods_items": [
                        {
                            "name": "商品1",
                            "value": "kPhM",
                            "description": null,
                            "inventory": null,
                            "hidden": false
                        },
                        {
                            "name": "商品2",
                            "value": "jtvG",
                            "description": null,
                            "inventory": null,
                            "hidden": false
                        }
                    ]
                }
            },
            {
                "field_18": {
                    "label": "未命名",
                    "type": "goods",
                    "notes": "",
                    "private": false,
                    "validation": {},
                    "goods_items": [
                        {
                            "name": "商品一",
                            "value": "2_eD",
                            "description": null,
                            "inventory": null,
                            "hidden": false
                        },
                        {
                            "name": "商品二",
                            "value": "tCfV",
                            "description": null,
                            "inventory": null,
                            "hidden": false
                        }
                    ]
                }
            },
            {
                "field_19": {
                    "label": "姓名",
                    "type": "single_line_text",
                    "notes": "",
                    "private": false,
                    "validation": {}
                }
            },
            {
                "field_20": {
                    "label": "手机",
                    "type": "mobile",
                    "notes": "",
                    "private": false,
                    "validation": {}
                }
            },
            {
                "field_21": {
                    "label": "邮箱",
                    "type": "email",
                    "notes": "",
                    "private": false,
                    "validation": {}
                }
            },
            {
                "field_22": {
                    "label": "电话",
                    "type": "phone",
                    "notes": "",
                    "private": false,
                    "validation": {}
                }
            },
            {
                "field_23": {
                    "label": "地址",
                    "type": "address",
                    "notes": "",
                    "private": false,
                    "validation": {}
                }
            },
            {
                "field_24": {
                    "label": "矩阵填空",
                    "type": "matrix",
                    "notes": "",
                    "private": false,
                    "validation": {},
                    "statements": [
                        {
                            "name": "矩阵填空题目1",
                            "value": "LddT"
                        },
                        {
                            "name": "矩阵填空题目2",
                            "value": "YOnD"
                        },
                        {
                            "name": "矩阵填空题目3",
                            "value": "odmQ"
                        }
                    ],
                    "dimensions": [
                        {
                            "field_1": {
                                "label": "矩阵填空项目1",
                                "type": "single_line_text",
                                "notes": null,
                                "private": false,
                                "validation": {}
                            }
                        },
                        {
                            "field_2": {
                                "label": "矩阵填空项目2",
                                "type": "single_line_text",
                                "notes": null,
                                "private": false,
                                "validation": {}
                            }
                        },
                        {
                            "field_3": {
                                "label": "矩阵填空项目3",
                                "type": "single_line_text",
                                "notes": null,
                                "private": false,
                                "validation": {}
                            }
                        }
                    ]
                }
            },
            {
                "field_26": {
                    "label": "矩阵选择",
                    "type": "likert",
                    "notes": "",
                    "private": false,
                    "validation": {},
                    "choices": [
                        {
                            "name": "矩阵选择选项1",
                            "value": "BxO0",
                            "hidden": false
                        },
                        {
                            "name": "矩阵选择选项2",
                            "value": "v3mY",
                            "hidden": false
                        },
                        {
                            "name": "矩阵选择选项3",
                            "value": "LaQ0",
                            "hidden": false
                        }
                    ],
                    "statements": [
                        {
                            "name": "矩阵选择1",
                            "value": "ZhCJ"
                        },
                        {
                            "name": "矩阵选择2",
                            "value": "Iapr"
                        },
                        {
                            "name": "矩阵选择3",
                            "value": "mxFX"
                        }
                    ]
                }
            },
            {
                "field_27": {
                    "label": "矩阵量表",
                    "type": "matrix_scale",
                    "notes": "",
                    "private": false,
                    "validation": {},
                    "statements": [
                        {
                            "name": "矩阵选择题目1",
                            "value": "WNWU"
                        },
                        {
                            "name": "矩阵选择题目2",
                            "value": "ZSny"
                        },
                        {
                            "name": "矩阵选择题目3",
                            "value": "W3wp"
                        }
                    ],
                    "dimensions": [
                        {
                            "field_1": {
                                "label": "项目",
                                "type": "rating",
                                "notes": null,
                                "private": false,
                                "validation": {},
                                "rating_type": "star",
                                "rating_max": 5
                            }
                        }
                    ]
                }
            },
            {
                "field_28": {
                    "label": "表格",
                    "type": "table",
                    "notes": "",
                    "private": false,
                    "validation": {},
                    "dimensions": [
                        {
                            "field_1": {
                                "label": "表格项目1",
                                "type": "single_line_text",
                                "notes": null,
                                "private": false,
                                "validation": {}
                            }
                        },
                        {
                            "field_2": {
                                "label": "表格项目2",
                                "type": "single_line_text",
                                "notes": null,
                                "private": false,
                                "validation": {}
                            }
                        },
                        {
                            "field_3": {
                                "label": "表格项目3",
                                "type": "single_line_text",
                                "notes": null,
                                "private": false,
                                "validation": {}
                            }
                        }
                    ]
                }
            },
            {
                "field_30": {
                    "label": "评分",
                    "type": "rating",
                    "notes": "",
                    "private": false,
                    "validation": {},
                    "rating_type": "star",
                    "rating_max": 5
                }
            },
            {
                "field_31": {
                    "label": "NPS",
                    "type": "nps",
                    "notes": "",
                    "private": false,
                    "validation": {},
                    "minimum_ratings_display_text": "不可能",
                    "maximum_ratings_display_text": "极有可能",
                    "highlight_color": "rgb(40,117,232)"
                }
            },
            {
                "field_32": {
                    "label": "排序",
                    "type": "sort",
                    "notes": "",
                    "private": false,
                    "validation": {},
                    "choices": [
                        {
                            "name": "选项",
                            "value": "cwCF",
                            "hidden": false
                        },
                        {
                            "name": "选项",
                            "value": "JQfr",
                            "hidden": false
                        },
                        {
                            "name": "选项",
                            "value": "tyn9",
                            "hidden": false
                        }
                    ]
                }
            },
            {
                "field_33": {
                    "label": "电子签名",
                    "type": "e_signature",
                    "notes": "",
                    "private": false,
                    "validation": {}
                }
            },
            {
                "field_34": {
                    "label": "横向填空",
                    "type": "multiple_blanks",
                    "notes": "",
                    "private": false,
                    "validation": {},
                    "placeholder": "太阳${field_1}$ 升,${field_2}$ 落",
                    "dimensions": [
                        {
                            "field_1": {
                                "label": "",
                                "type": "single_line_text",
                                "notes": null,
                                "private": false,
                                "validation": {}
                            }
                        },
                        {
                            "field_2": {
                                "label": "",
                                "type": "single_line_text",
                                "notes": null,
                                "private": false,
                                "validation": {}
                            }
                        }
                    ]
                }
            },
            {
                "field_35": {
                    "label": "表单关联",
                    "type": "form_association",
                    "notes": "",
                    "private": false,
                    "validation": {},
                    "associated_form_token": "ezjDSo",
                    "associated_field_api_code": "field_1",
                    "associated_field_api_codes": [
                        "field_1"
                    ],
                    "display_field_settings": [
                        {
                            "api_code": "field_2",
                            "privacy_safe": true,
                            "public_display": true
                        }
                    ]
                }
            }
        ]
    }

👉联系技术咨询

有帮助(74) 未解决问题?