返回顶部
b

box盒子

|

作者: admin | 来源: ClawHub
源自
ClawHub
版本
V 1.0.5
安全检测
已通过
3,591
下载量
免费
免费
3
收藏
概述
安装方式
版本历史

box

Box

通过托管OAuth认证访问Box API。管理文件、文件夹、协作、共享链接和云存储。

快速开始

bash

获取当前用户信息


python < import urllib.request, os, json
req = urllib.request.Request(https://gateway.maton.ai/box/2.0/users/me)
req.addheader(Authorization, fBearer {os.environ[MATONAPI_KEY]})
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF

基础URL

https://gateway.maton.ai/box/2.0/{resource}

网关将请求代理到api.box.com/2.0(对于大多数端点)或upload.box.com/api/2.0(对于上传端点),并自动注入您的OAuth令牌。路由根据端点路径自动处理。

认证

所有请求都需要在Authorization头中包含Maton API密钥:

Authorization: Bearer $MATONAPIKEY

环境变量: 将您的API密钥设置为MATONAPIKEY:

bash
export MATONAPIKEY=YOURAPIKEY

获取您的API密钥

  1. 1. 在maton.ai登录或创建账户
  2. 前往maton.ai/settings
  3. 复制您的API密钥

连接管理

在https://ctrl.maton.ai管理您的Box OAuth连接。

列出连接

bash
python < import urllib.request, os, json
req = urllib.request.Request(https://ctrl.maton.ai/connections?app=box&status=ACTIVE)
req.addheader(Authorization, fBearer {os.environ[MATONAPI_KEY]})
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF

创建连接

bash
python < import urllib.request, os, json
data = json.dumps({app: box}).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 < import urllib.request, os, json
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: {
connectionid: {connectionid},
status: ACTIVE,
creation_time: 2026-02-08T21:14:41.808115Z,
lastupdatedtime: 2026-02-08T21:16:10.100340Z,
url: https://connect.maton.ai/?session_token=...,
app: box,
metadata: {}
}
}

在浏览器中打开返回的url以完成OAuth授权。

删除连接

bash
python < import urllib.request, os, json
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

指定连接

如果您有多个Box连接,请使用Maton-Connection头指定要使用的连接:

bash
python < import urllib.request, os, json
req = urllib.request.Request(https://gateway.maton.ai/box/2.0/users/me)
req.addheader(Authorization, fBearer {os.environ[MATONAPI_KEY]})
req.addheader(Maton-Connection, {connectionid})
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF

如果省略,网关将使用默认(最旧的)活动连接。

API参考

用户信息

获取当前用户

bash
GET /box/2.0/users/me

响应:
json
{
type: user,
id: 48806418054,
name: Chris,
login: chris@example.com,
created_at: 2026-02-08T13:12:34-08:00,
modified_at: 2026-02-08T13:12:35-08:00,
language: en,
timezone: America/Los_Angeles,
space_amount: 10737418240,
space_used: 0,
maxuploadsize: 262144000,
status: active,
avatar_url: https://app.box.com/api/avatar/large/48806418054
}

获取用户

bash
GET /box/2.0/users/{user_id}

文件夹操作

获取根文件夹

根文件夹的ID为0:

bash
GET /box/2.0/folders/0

获取文件夹

bash
GET /box/2.0/folders/{folder_id}

响应:
json
{
type: folder,
id: 365037181307,
name: My Folder,
description: Folder description,
size: 0,
path_collection: {
total_count: 1,
entries: [
{type: folder, id: 0, name: All Files}
]
},
created_by: {type: user, id: 48806418054, name: Chris},
owned_by: {type: user, id: 48806418054, name: Chris},
item_status: active
}

列出文件夹项目

bash
GET /box/2.0/folders/{folder_id}/items

查询参数:

  • - limit - 返回的最大项目数(默认100,最大1000)
  • offset - 分页偏移量
  • fields - 要包含的字段列表,逗号分隔

响应:
json
{
total_count: 1,
entries: [
{
type: folder,
id: 365036703666,
name: Subfolder
}
],
offset: 0,
limit: 100
}

创建文件夹

bash
POST /box/2.0/folders
Content-Type: application/json

{
name: New Folder,
parent: {id: 0}
}

响应:
json
{
type: folder,
id: 365037181307,
name: New Folder,
created_at: 2026-02-08T14:56:17-08:00
}

更新文件夹

bash
PUT /box/2.0/folders/{folder_id}
Content-Type: application/json

{
name: Updated Folder Name,
description: Updated description
}

复制文件夹

bash
POST /box/2.0/folders/{folder_id}/copy
Content-Type: application/json

{
name: Copied Folder,
parent: {id: 0}
}

删除文件夹

bash
DELETE /box/2.0/folders/{folder_id}

查询参数:

  • - recursive - 设置为true以删除非空文件夹

成功时返回204 No Content。

文件操作

获取文件信息

bash
GET /box/2.0/files/{file_id}

下载文件

bash
GET /box/2.0/files/{file_id}/content

返回下载URL的重定向。

上传文件

上传新文件(直接上传最多50 MB):

bash
POST /box/api/2.0/files/content
Content-Type: multipart/form-data

attributes={name:file.txt,parent:{id:0}}
file=<二进制数据>

attributes字段是一个JSON字符串,包含:

  • - name(必需)- 要使用的文件名
  • parent.id(必需)- 上传到的文件夹ID(使用0表示根目录)
  • contentcreatedat - 可选时间戳
  • contentmodifiedat - 可选时间戳

响应:
json
{
total_count: 1,
entries: [
{
type

标签

skill ai

通过对话安装

该技能支持在以下平台通过对话安装:

OpenClaw WorkBuddy QClaw Kimi Claude

方式一:安装 SkillHub 和技能

帮我安装 SkillHub 和 box-1776419959 技能

方式二:设置 SkillHub 为优先技能安装源

设置 SkillHub 为我的优先技能安装源,然后帮我安装 box-1776419959 技能

通过命令行安装

skillhub install box-1776419959

下载

⬇ 下载 box v1.0.5(免费)

文件大小: 7.19 KB | 发布时间: 2026-4-17 18:26

v1.0.5 最新 2026-4-17 18:26
- Clarified security model: MATON_API_KEY does not grant Box access by itself—OAuth user authorization is required for Box connection.
- Updated description to emphasize strict Box access scoping per user OAuth authorization.
- No functional or API changes. This version improves documentation clarity around authentication and access control.

Archiver·手机版·闲社网·闲社论坛·羊毛社区· 多链控股集团有限公司 · 苏ICP备2025199260号-1

Powered by Discuz! X5.0   © 2024-2025 闲社网·线报更新论坛·羊毛分享社区·http://xianshe.com

p2p_official_large
返回顶部