合集
将资产整理到合集中:合集是您拥有的文件夹,也可以嵌套到另一个合集之内。
端点
| 方法 | 路径 | |
|---|---|---|
| POST | /v1/collections | 创建 |
| GET | /v1/collections | 合集列表 |
| GET | /v1/collections/{id}/assets | 列出合集内的资产 |
| POST | /v1/collections/{id}/assets | 添加资产 |
| POST | /v1/collections/{id}/assets/remove | 移除资产 |
| PATCH | /v1/collections/{id} | 重命名 |
| DELETE | /v1/collections/{id} | 删除 |
创建合集
POST/v1/collections
| 参数 | 说明 |
|---|---|
| name必填 string | 合集名称,1–255 个字符。 |
| parentId可选 string | 用于嵌套此合集的父合集 id。省略则为顶级合集。 |
请求
curl -X POST https://api.picoberry.ai/v1/collections \
-H "Authorization: Bearer pb_live_xxx" -H "Content-Type: application/json" \
-d '{"name":"Hero Props"}'requests.post(f"{BASE}/v1/collections", headers=headers,
json={"name": "Hero Props"})await fetch(`${BASE}/v1/collections`, { method: "POST",
headers: { ...headers, "Content-Type": "application/json" },
body: JSON.stringify({ name: "Hero Props" }) });响应 · 200
{ "success": true, "data": { "id": "019…", "name": "Hero Props", "parentId": null } }合集列表
GET/v1/collections
在 data 中返回您的合集列表。
请求
curl https://api.picoberry.ai/v1/collections \
-H "Authorization: Bearer pb_live_xxx"列出合集内的资产
GET/v1/collections/{id}/assets
| 参数 | 说明 |
|---|---|
| page可选默认 1 integer | 从 1 开始的页码。 |
| limit可选默认 20 integer | 每页数量,最多 100。 |
data 是资产数组,每一项的结构与 GET /v1/assets/{id} 相同。
添加资产
POST/v1/collections/{id}/assets
| 参数 | 说明 |
|---|---|
| assetIds必填 string[] | 要添加的资产 id:每次调用 1 到 200 个。 |
请求
curl -X POST https://api.picoberry.ai/v1/collections/019…/assets \
-H "Authorization: Bearer pb_live_xxx" -H "Content-Type: application/json" \
-d '{"assetIds":["019a…","019b…"]}'requests.post(f"{BASE}/v1/collections/{id}/assets", headers=headers,
json={"assetIds": ["019a…", "019b…"]})await fetch(`${BASE}/v1/collections/${id}/assets`, { method: "POST",
headers: { ...headers, "Content-Type": "application/json" },
body: JSON.stringify({ assetIds: ["019a…", "019b…"] }) });响应 · 200
{ "success": true, "data": { "id": "019…" } }移除资产
POST/v1/collections/{id}/assets/remove
请求体 { assetIds } 为字符串数组。将这些资产从合集中移除;资产本身不会被删除。
请求
curl -X POST https://api.picoberry.ai/v1/collections/019…/assets/remove \
-H "Authorization: Bearer pb_live_xxx" -H "Content-Type: application/json" \
-d '{"assetIds":["019a…"]}'重命名
PATCH/v1/collections/{id}
请求体 { name } 为新名称,1–255 个字符。
请求
curl -X PATCH https://api.picoberry.ai/v1/collections/019… \
-H "Authorization: Bearer pb_live_xxx" -H "Content-Type: application/json" \
-d '{"name":"Boss Props"}'删除
DELETE/v1/collections/{id}
删除该合集。其中的资产不会被删除,仍会保留在您的资产库中。
请求
curl -X DELETE https://api.picoberry.ai/v1/collections/019… \
-H "Authorization: Bearer pb_live_xxx"所有内容都限定在您的密钥范围内 您只能查看和修改自己的 API 密钥所拥有的合集与资产;其他情况将返回
404。参见错误。