JotForm
2026-03-28
新闻来源:网淘吧
围观:26
电脑广告
手机广告
JotForm
通过托管的 OAuth 认证访问 JotForm API。创建和管理表单、获取提交内容以及管理 Webhook。
快速开始
# List user forms
python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://gateway.maton.ai/jotform/user/forms?limit=20')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF
基础 URL
https://gateway.maton.ai/jotform/{native-api-path}
将{native-api-path}替换为实际的 JotForm API 端点路径。网关会将请求代理到api.jotform.com并自动注入您的 API 密钥。
认证
所有请求都需要在 Authorization 请求头中包含 Maton API 密钥:
Authorization: Bearer $MATON_API_KEY
环境变量:将您的 API 密钥设置为MATON_API_KEY:
export MATON_API_KEY="YOUR_API_KEY"
获取您的 API 密钥
复制您的 API 密钥
在此处管理您的 JotForm 连接https://ctrl.maton.ai。
列出连接
python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://ctrl.maton.ai/connections?app=jotform&status=ACTIVE')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF
创建连接
python <<'EOF'
import urllib.request, os, json
data = json.dumps({'app': 'jotform'}).encode()
req = urllib.request.Request('https://ctrl.maton.ai/connections', data=data, method='POST')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
req.add_header('Content-Type', 'application/json')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF
获取连接
python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://ctrl.maton.ai/connections/{connection_id}')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF
响应:
{
"connection": {
"connection_id": "21fd90f9-5935-43cd-b6c8-bde9d915ca80",
"status": "ACTIVE",
"creation_time": "2025-12-08T07:20:53.488460Z",
"last_updated_time": "2026-01-31T20:03:32.593153Z",
"url": "https://connect.maton.ai/?session_token=...",
"app": "jotform",
"metadata": {}
}
}
在浏览器中打开返回的网址以完成 OAuth 授权。
删除连接
python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://ctrl.maton.ai/connections/{connection_id}', method='DELETE')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF
指定连接
如果您有多个 JotForm 连接,请使用Maton-Connection请求头指定要使用的连接:
python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://gateway.maton.ai/jotform/user/forms')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
req.add_header('Maton-Connection', '21fd90f9-5935-43cd-b6c8-bde9d915ca80')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF
如果省略,网关将使用默认(最早创建的)活跃连接。
API 参考
用户
GET /jotform/user
GET /jotform/user/forms?limit=20
GET /jotform/user/submissions?limit=20
GET /jotform/user/usage
表单
获取表单
GET /jotform/form/{formId}
获取表单问题
GET /jotform/form/{formId}/questions
获取表单提交
GET /jotform/form/{formId}/submissions?limit=20
使用过滤器:
GET /jotform/form/{formId}/submissions?filter={"created_at:gt":"2024-01-01"}
创建表单
POST /jotform/user/forms
Content-Type: application/json
{
"properties": {"title": "Contact Form"},
"questions": {
"1": {"type": "control_textbox", "text": "Name", "name": "name"},
"2": {"type": "control_email", "text": "Email", "name": "email"}
}
}
删除表单
DELETE /jotform/form/{formId}
提交内容
获取提交内容
GET /jotform/submission/{submissionId}
删除提交内容
DELETE /jotform/submission/{submissionId}
Webhooks
GET /jotform/form/{formId}/webhooks
POST /jotform/form/{formId}/webhooks
DELETE /jotform/form/{formId}/webhooks/{webhookIndex}
问题类型
control_textbox- 单行文本control_textarea- 多行文本control_email- 电子邮件control_phone- 电话号码control_dropdown- 下拉菜单control_radio- 单选按钮control_checkbox- 复选框control_datetime- 日期/时间选择器control_fileupload- 文件上传
筛选语法
{"field:gt":"value"} // Greater than
{"field:lt":"value"} // Less than
{"field:eq":"value"} // Equal to
代码示例
JavaScript
const response = await fetch(
'https://gateway.maton.ai/jotform/user/forms?limit=10',
{
headers: {
'Authorization': `Bearer ${process.env.MATON_API_KEY}`
}
}
);
Python
import os
import requests
response = requests.get(
'https://gateway.maton.ai/jotform/user/forms',
headers={'Authorization': f'Bearer {os.environ["MATON_API_KEY"]}'},
params={'limit': 10}
)
注意事项
- 表单ID为数字类型
- 分页功能使用
limit和offset - 参数
使用orderby - 参数对结果进行排序
重要提示:使用curl命令时,若URL包含方括号(fields[]、sort[]、records[] )请使用curl -g参数以禁用通配符解析 - 重要提示:当通过管道将curl输出传递给
jq或其他命令时,需注意环境变量(如$MATON_API_KEY在某些shell环境中可能无法正确展开。通过管道传输时,您可能会遇到"无效API密钥"的错误。
错误处理
| 状态码 | 含义 |
|---|---|
| 400 | 缺少JotForm连接 |
| 401 | Maton API密钥无效或缺失 |
| 429 | 请求频率受限(每个账户每秒10次请求) |
| 4xx/5xx | 来自JotForm API的透传错误 |
故障排除:API密钥问题
- 检查
MATON_API_KEY环境变量是否已设置:
echo $MATON_API_KEY
- 通过列出连接来验证API密钥是否有效:
python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://ctrl.maton.ai/connections')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF
故障排除:无效应用名称
- 请确保您的URL路径以
jotform开头。例如:
- 正确示例:
https://gateway.maton.ai/jotform/user/forms - 不正确
https://gateway.maton.ai/user/forms
资源
文章底部电脑广告
手机广告位-内容正文底部


微信扫一扫,打赏作者吧~