资源接口
创建资源
http
POST /api/model-resources请求参数:
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
name | string | 是 | 资源名称 |
description | string | 否 | 资源描述 |
resourceType | int | 否 | 资源类型,1:Image、2:Video、3:Audio,默认为 1 |
group_id | int | 是 | 资源分组 ID |
url | string | 是 | 资源 URL |
请求示例:
bash
curl --location 'https://neolink.com/api/api/model-resources' \
--header 'Authorization: Bearer <api-key>' \
--header 'Content-Type: application/json' \
--data '{
"name": "product-demo.png",
"description": "张三",
"group_id": 8,
"url": "https://example.com/product-demo.png"
}'返回示例:
json
{
"success": true,
"message": "",
"data": {
"uuid": "tkres_b6b6fbfcd79940ecb4d24afee99a4ca9",
"group_id": 8,
"name": "product-demo.png",
"description": "张三",
"busi_type": 1,
"url": "https://example.com/product-demo.png",
"status": 2,
"message": "",
"created_at": 1779332818,
"updated_at": 1779332818,
"deleted_at": null
}
}状态字段status说明:
- 创建后初始状态为
2处理中。 - 同步成功后状态变为
1可用。 - 同步失败后状态变为
3失败,失败原因在message中。
查询资源列表
http
GET /api/model-resourcesQuery 参数:
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
p | int | 否 | 页码,默认 1 |
page_size | int | 否 | 每页数量 |
group_id | int | 否 | 按资源组过滤 |
status | int | 否 | 按资源状态过滤 |
keyword | string | 否 | 按名称、描述或 UUID 搜索 |
created_start | int64 | 否 | 创建时间起始时间戳 |
created_end | int64 | 否 | 创建时间结束时间戳 |
请求示例:
bash
curl --location 'https://neolink.com/api/api/model-resources?p=1&page_size=20&group_id=8' \
--header 'Authorization: Bearer <api-key>'返回示例:
json
{
"success": true,
"message": "",
"data": {
"page": 1,
"page_size": 20,
"total": 1,
"items": [
{
"uuid": "tkres_b6b6fbfcd79940ecb4d24afee99a4ca9",
"group_id": 8,
"name": "product-demo.png",
"description": "张三",
"busi_type": 1,
"url": "https://example.com/product-demo.png",
"status": 1,
"message": "",
"created_at": 1779332818,
"updated_at": 1779332818,
"deleted_at": null
}
]
}
}查询资源详情
http
GET /api/model-resources/{uuid}请求示例:
bash
curl --location 'https://neolink.com/api/api/model-resources/tkres_b6b6fbfcd79940ecb4d24afee99a4ca9' \
--header 'Authorization: Bearer <api-key>'返回字段同查询资源列表中的单条资源。
更新资源
http
PATCH /api/model-resources/{uuid}
PUT /api/model-resources/{uuid}仅限更新名称、描述和分组。
请求参数:
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
name | string | 否 | 新资源名称 |
description | string | 否 | 新资源描述 |
group_id | int | 是 | 新资源组 ID |
请求示例:
bash
curl --location --request PATCH 'https://neolink.com/api/api/model-resources/tkres_b6b6fbfcd79940ecb4d24afee99a4ca9' \
--header 'Authorization: Bearer <api-key>' \
--header 'Content-Type: application/json' \
--data '{
"name": "product-demo-v2.png",
"description": "新的描述"
}'返回字段同查询资源列表中的单条资源。
