|
通过托管的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: [标签1, 标签2],
autoScheduled: {
startDate: 2024-03-14T09:00:00Z,
deadlineType: SOFT,
schedule: 工作时间
}
}
必填字段:
可选字段:
示例:
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: 已完成,
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-1776113303 技能
设置 SkillHub 为我的优先技能安装源,然后帮我安装 motion-1776113303 技能
skillhub install motion-1776113303
文件大小: 4.89 KB | 发布时间: 2026-4-15 13:29