Skip to main content

Project API

Project API 提供了对 AI 工作流项目的创建、管理和部署等功能。这些接口允许你管理整个项目的生命周期,包括创建新项目、更新项目信息、查看项目运行记录和部署状态等。

创建项目

/project
创建新的 AI 工作流项目。

请求参数

参数名类型必选说明
templatestring项目模板
namestring项目名称
toolsstring[]使用的工具
accessstring访问权限
POST /project
Content-Type: application/json
Authorization: Bearer YOUR_TOKEN

{
  "name": "新项目",
  "template": "chat-bot",
  "tools": ["gpt-3.5", "stable-diffusion"],
  "access": "private"
}

获取项目列表

/project/list
获取项目列表。

请求参数

参数名类型必选说明
pageinteger页码,默认1
sizeinteger每页数量
GET /project/list?page=1&size=10
Content-Type: application/json
Authorization: Bearer YOUR_TOKEN

获取项目详情

/project/:projectId
获取指定项目的详细信息。

请求参数

参数名类型必选说明
projectIdstring项目ID
GET /project/project_123
Content-Type: application/json
Authorization: Bearer YOUR_TOKEN

更新项目

/project/:projectId
更新指定项目的信息。

请求参数

参数名类型必选说明
projectIdstring项目ID
namestring项目名称
descriptionstring项目描述
toolsstring[]使用的工具
accessstring访问权限
PUT /project/project_123
Content-Type: application/json
Authorization: Bearer YOUR_TOKEN

{
  "name": "更新后的项目",
  "description": "这是更新后的项目描述",
  "access": "public"
}

删除项目

/project/:projectId
删除指定的项目。

请求参数

参数名类型必选说明
projectIdstring项目ID
DELETE /project/project_123
Content-Type: application/json
Authorization: Bearer YOUR_TOKEN

获取项目运行记录

/project/:projectId/runs
获取项目的运行记录。

请求参数

参数名类型必选说明
projectIdstring项目ID
pageinteger页码,默认1
sizeinteger每页数量
GET /project/project_123/runs?page=1&size=10
Content-Type: application/json
Authorization: Bearer YOUR_TOKEN

获取项目部署列表

/project/:projectId/deployments
获取项目的部署列表。

请求参数

参数名类型必选说明
projectIdstring项目ID
pageinteger页码,默认1
sizeinteger每页数量
GET /project/project_123/deployments?page=1&size=10
Content-Type: application/json
Authorization: Bearer YOUR_TOKEN

获取部署详情

/project/deployment/:bid
获取指定块的部署详情。

请求参数

参数名类型必选说明
bidstring块ID
GET /project/deployment/block_123
Content-Type: application/json
Authorization: Bearer YOUR_TOKEN

安装块

/project/:projectId/install/:blockId
在项目中安装指定的块。

请求参数

参数名类型必选说明
projectIdstring项目ID
blockIdstring块ID
POST /project/project_123/install/block_124
Content-Type: application/json
Authorization: Bearer YOUR_TOKEN

搜索项目资源

搜索项目中的页面或部署。

请求参数

参数名类型必选说明
projectIdstring项目ID
typestring搜索类型:page/deployment
fromBidstring起始块ID
nextVersionboolean是否获取下一个版本
GET /project/project_123/search?type=page
Content-Type: application/json
Authorization: Bearer YOUR_TOKEN

获取回收站列表

/project/:projectId/trash
获取项目回收站中的块列表。

请求参数

参数名类型必选说明
projectIdstring项目ID
GET /project/project_123/trash
Content-Type: application/json
Authorization: Bearer YOUR_TOKEN

获取块版本历史

/project/:pid/versions/:bid
获取指定块的版本历史。

请求参数

参数名类型必选说明
pidstring项目ID
bidstring块ID
GET /project/project_123/versions/block_123
Content-Type: application/json
Authorization: Bearer YOUR_TOKEN

恢复块

/project/:pid/restore/:bid
从回收站恢复指定的块。

请求参数

参数名类型必选说明
pidstring项目ID
bidstring块ID
POST /project/project_123/restore/block_125
Content-Type: application/json
Authorization: Bearer YOUR_TOKEN

清空回收站

/project/restore-trash
清空项目的回收站。
POST /project/restore-trash
Content-Type: application/json
Authorization: Bearer YOUR_TOKEN

错误码说明

错误码说明

错误码说明
400请求参数错误
401未授权或令牌无效
403权限不足
404项目或资源不存在
409项目名称已存在
422请求参数验证失败
500服务器错误