|
通过托管OAuth认证访问Google Forms API。创建表单、添加问题并获取回复。
bash
https://gateway.maton.ai/google-forms/{native-api-path}
将{native-api-path}替换为实际的Google Forms API端点路径。网关将请求代理到forms.googleapis.com并自动注入您的OAuth令牌。
所有请求都需要在Authorization头中包含Maton API密钥:
Authorization: Bearer $MATONAPIKEY
环境变量: 将您的API密钥设置为MATONAPIKEY:
bash
export MATONAPIKEY=YOURAPIKEY
在https://ctrl.maton.ai管理您的Google OAuth连接。
bash
python <
req = urllib.request.Request(https://ctrl.maton.ai/connections?app=google-forms&status=ACTIVE)
req.addheader(Authorization, fBearer {os.environ[MATONAPI_KEY]})
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF
bash
python <
data = json.dumps({app: google-forms}).encode()
req = urllib.request.Request(https://ctrl.maton.ai/connections, data=data, method=POST)
req.addheader(Authorization, fBearer {os.environ[MATONAPI_KEY]})
req.add_header(Content-Type, application/json)
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF
bash
python <
req = urllib.request.Request(https://ctrl.maton.ai/connections/{connection_id})
req.addheader(Authorization, fBearer {os.environ[MATONAPI_KEY]})
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF
响应:
json
{
connection: {
connection_id: 21fd90f9-5935-43cd-b6c8-bde9d915ca80,
status: ACTIVE,
creation_time: 2025-12-08T07:20:53.488460Z,
lastupdatedtime: 2026-01-31T20:03:32.593153Z,
url: https://connect.maton.ai/?session_token=...,
app: google-forms,
metadata: {}
}
}
在浏览器中打开返回的url以完成OAuth授权。
bash
python <
req = urllib.request.Request(https://ctrl.maton.ai/connections/{connection_id}, method=DELETE)
req.addheader(Authorization, fBearer {os.environ[MATONAPI_KEY]})
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF
如果您有多个Google Forms连接,请使用Maton-Connection头指定要使用的连接:
bash
python <
req = urllib.request.Request(https://gateway.maton.ai/google-forms/v1/forms/{formId})
req.addheader(Authorization, fBearer {os.environ[MATONAPI_KEY]})
req.add_header(Maton-Connection, 21fd90f9-5935-43cd-b6c8-bde9d915ca80)
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF
如果省略,网关将使用默认(最早创建的)活跃连接。
bash
GET /google-forms/v1/forms/{formId}
bash
POST /google-forms/v1/forms
Content-Type: application/json
{
info: {
title: 客户反馈调查
}
}
bash
POST /google-forms/v1/forms/{formId}:batchUpdate
Content-Type: application/json
{
requests: [
{
createItem: {
item: {
title: 您叫什么名字?,
questionItem: {
question: {
required: true,
textQuestion: {paragraph: false}
}
}
},
location: {index: 0}
}
}
]
}
bash
GET /google-forms/v1/forms/{formId}/responses
bash
GET /google-forms/v1/forms/{formId}/responses/{responseId}
json
{
createItem: {
item: {
title: 问题文本,
questionItem: {
question: {
required: true,
textQuestion: {paragraph: false}
}
}
},
location: {index: 0}
}
}
json
{
createItem: {
item: {
title: 选择一个选项,
questionItem: {
question: {
choiceQuestion: {
type: RADIO,
options: [
{value: 选项A},
{value: 选项B}
]
}
}
}
},
location: {index: 0}
}
}
json
{
createItem: {
item: {
title: 评价您的体验,
questionItem: {
question: {
scaleQuestion: {
low: 1,
high: 5,
lowLabel: 差,
highLabel: 优秀
}
}
}
},
location: {index: 0}
}
}
javascript
const response = await fetch(
https://gateway.maton.ai/google-forms/v1/forms/FORM_ID/responses,
{
headers: {
Authorization: Bearer ${process.env.MATONAPIKEY}
}
}
);
python
import os
import requests
response = requests.get(
fhttps://gateway.maton.ai/google-forms/v1/forms/FORM_ID/responses,
headers={Authorization: fBearer {os.environ[MATONAPIKEY]}}
)
| 状态码 | 含义 |
|---|---|
| 400 | 缺少Google Forms连接 |
| 401 |
bash
echo $MATONAPIKEY
bash
python <
req = urllib.request.Request(https://ctrl.maton.ai/connections)
req.addheader(Authorization, fBearer {os.environ[MATONAPI_KEY]})
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF
该技能支持在以下平台通过对话安装:
帮我安装 SkillHub 和 google-forms-1775945987 技能
设置 SkillHub 为我的优先技能安装源,然后帮我安装 google-forms-1775945987 技能
skillhub install google-forms-1775945987
文件大小: 3.92 KB | 发布时间: 2026-4-12 10:08