|
通过托管OAuth认证访问Google Slides API。创建和管理演示文稿,添加幻灯片,插入文本和图片,并控制格式。
bash
https://gateway.maton.ai/google-slides/{native-api-path}
将{native-api-path}替换为实际的Google Slides API端点路径。网关将请求代理到slides.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-slides&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-slides}).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-slides,
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 Slides连接,请使用Maton-Connection头指定要使用的连接:
bash
python <
data = json.dumps({title: 我的演示文稿}).encode()
req = urllib.request.Request(https://gateway.maton.ai/google-slides/v1/presentations, data=data, method=POST)
req.addheader(Authorization, fBearer {os.environ[MATONAPI_KEY]})
req.add_header(Content-Type, application/json)
req.add_header(Maton-Connection, 21fd90f9-5935-43cd-b6c8-bde9d915ca80)
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF
如果省略,网关将使用默认(最旧)的活动连接。
bash
POST /google-slides/v1/presentations
Content-Type: application/json
{
title: 我的演示文稿
}
bash
GET /google-slides/v1/presentations/{presentationId}
bash
GET /google-slides/v1/presentations/{presentationId}/pages/{pageId}
bash
GET /google-slides/v1/presentations/{presentationId}/pages/{pageId}/thumbnail
自定义尺寸:
bash
GET /google-slides/v1/presentations/{presentationId}/pages/{pageId}/thumbnail?thumbnailProperties.mimeType=PNG&thumbnailProperties.thumbnailSize=LARGE
batchUpdate端点用于大多数修改。它接受一个请求数组,这些请求将被原子性地应用。
bash
POST /google-slides/v1/presentations/{presentationId}:batchUpdate
Content-Type: application/json
{
requests: [...]
}
bash
POST /google-slides/v1/presentations/{presentationId}:batchUpdate
Content-Type: application/json
{
requests: [
{
createSlide: {
objectId: slide_001,
slideLayoutReference: {
predefinedLayout: TITLEANDBODY
}
}
}
]
}
可用的预定义布局:
bash
POST /google-slides/v1/presentations/{presentationId}:batchUpdate
Content-Type: application/json
{
requests: [
{
insertText: {
objectId: {shapeId},
text: 你好,世界!,
insertionIndex: 0
}
}
]
}
bash
POST /google-slides/v1/presentations/{presentationId}:batchUpdate
Content-Type: application/json
{
requests: [
{
deleteText: {
objectId: {shapeId},
textRange: {
type: ALL
}
}
}
]
}
bash
POST /google-slides/v1/presentations/{presentationId}:batchUpdate
Content-Type: application/json
{
requests: [
{
createShape: {
objectId: shape_001,
shapeType: TEXT_BOX,
elementProperties: {
pageObjectId: {slideId},
size: {
width: {magnitude: 300, unit: PT},
height: {magnitude: 100, unit: PT}
},
transform: {
scaleX: 1,
scaleY: 1,
translateX: 100,
translateY: 100,
unit: PT
}
}
}
}
]
}
bash
POST /google-slides/v1/presentations/{presentationId}:batchUpdate
Content-Type: application/json
{
requests: [
{
createImage: {
objectId: image_001,
url: https://example.com/image.png,
elementProperties: {
pageObjectId: {slideId},
size: {
width: {magnitude: 200, unit: PT},
height: {magnitude: 200, unit: PT}
},
transform: {
scaleX: 1,
scaleY: 1,
translateX: 200,
translateY: 200,
unit: PT
}
}
}
}
]
}
bash
该技能支持在以下平台通过对话安装:
帮我安装 SkillHub 和 google-slides-1776362990 技能
设置 SkillHub 为我的优先技能安装源,然后帮我安装 google-slides-1776362990 技能
skillhub install google-slides-1776362990
文件大小: 4.71 KB | 发布时间: 2026-4-17 15:56