コレクション
アセットをコレクションにまとめます。コレクションは自分が所有するフォルダーで、別のコレクションの中に入れ子にすることもできます。
エンドポイント
| メソッド | パス | |
|---|---|---|
| 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回の呼び出しで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 を返します。エラーを参照してください。