|
通过托管 OAuth 认证访问 Motion API。支持对任务、项目、工作区、评论和重复任务进行完整的增删改查操作。
bash
https://gateway.maton.ai/motion/{native-api-path}
将 {native-api-path} 替换为实际的 Motion API 端点路径。网关会将请求代理到 api.usemotion.com,并自动注入您的 OAuth 令牌。
所有请求都需要在 Authorization 请求头中携带 Maton API 密钥:
Authorization: Bearer $MATONAPIKEY
环境变量: 将您的 API 密钥设置为 MATONAPIKEY:
bash
export MATONAPIKEY=YOURAPIKEY
在 https://ctrl.maton.ai 管理您的 Motion OAuth 连接。
bash
python <
req = urllib.request.Request(https://ctrl.maton.ai/connections?app=motion&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: motion}).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: motion,
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
如果您有多个 Motion 连接,可以使用 Maton-Connection 请求头指定要使用的连接:
bash
python <
req = urllib.request.Request(https://gateway.maton.ai/motion/v1/tasks)
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 /motion/v1/tasks
查询参数:
示例:
bash
python <
req = urllib.request.Request(https://gateway.maton.ai/motion/v1/tasks?workspaceId=WORKSPACE_ID)
req.addheader(Authorization, fBearer {os.environ[MATONAPI_KEY]})
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF
bash
GET /motion/v1/tasks/{taskId}
bash
POST /motion/v1/tasks
Content-Type: application/json
{
name: 任务名称,
workspaceId: WORKSPACE_ID,
dueDate: 2024-03-15T10:00:00Z,
duration: 60,
priority: HIGH,
description: Markdown 格式的任务描述,
projectId: PROJECT_ID,
assigneeId: USER_ID,
labels: [label1, label2],
autoScheduled: {
startDate: 2024-03-14T09:00:00Z,
deadlineType: SOFT,
schedule: Work Hours
}
}
必填字段:
可选字段:
示例:
bash
python <
data = json.dumps({
name: 新任务,
workspaceId: WORKSPACE_ID,
priority: HIGH,
duration: 30
}).encode()
req = urllib.request.Request(https://gateway.maton.ai/motion/v1/tasks, 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
PATCH /motion/v1/tasks/{taskId}
Content-Type: application/json
{
name: 更新后的任务名称,
status: Completed,
priority: LOW
}
bash
DELETE /motion/v1/tasks/{taskId}
bash
POST /motion/v1/tasks/{taskId}/move
Content-Type: application/json
{
workspaceId: NEWWORKSPACEID
}
bash
POST /motion/v1/tasks/{taskId}/unassign
bash
GET /motion/v1/projects?workspaceId={workspaceId}
查询参数:
该技能支持在以下平台通过对话安装:
帮我安装 SkillHub 和 motion-1776420088 技能
设置 SkillHub 为我的优先技能安装源,然后帮我安装 motion-1776420088 技能
skillhub install motion-1776420088
文件大小: 4.86 KB | 发布时间: 2026-4-17 19:07