创建项目
OpenAPI 契约
- 方法
- POST
- 路径
/api/v1/projects- 认证
- jwtBearer (bearer) OR automationKey (bearer)
- 响应状态
- 201 400 401 403 404 409 429 500
请求与响应 Schema
JSON
{
"requestBody": {
"application/json": {
"$ref": "#/components/schemas/CreateProjectRequest"
}
},
"responses": {
"201": {
"description": "Project created",
"content": {
"application/json": {
"$ref": "#/components/schemas/ProjectResponse"
}
}
},
"400": {
"description": "Invalid request",
"content": {
"application/json": {
"$ref": "#/components/schemas/RequestError"
}
}
},
"401": {
"description": "Authentication required or invalid",
"content": {
"application/json": {
"$ref": "#/components/schemas/SecurityError"
}
}
},
"403": {
"description": "Authenticated but not permitted",
"content": {
"application/json": {
"$ref": "#/components/schemas/SecurityError"
}
}
},
"404": {
"description": "Requested project or build was not found",
"content": {
"application/json": {
"$ref": "#/components/schemas/ApiError"
}
}
},
"409": {
"description": "Request conflicts with current project state",
"content": {
"application/json": {
"$ref": "#/components/schemas/ApiError"
}
}
},
"429": {
"description": "HTTP rate limit or API-key NCU usage limit exceeded",
"content": {
"application/json": {
"$ref": "#/components/schemas/RateLimitError"
}
}
},
"500": {
"description": "Unexpected server error",
"content": {
"application/json": {
"$ref": "#/components/schemas/ApiError"
}
}
}
}
}POST /api/v1/projects 接受 JWT 或带 project:write 的 nfy_ 密钥。省略 workspaceId query parameter 时使用调用方的默认 workspace,也可选择调用方具有 project:create 的 workspace。归档 workspace 会拒绝创建。新项目初始为 RESTRICTED,创建者获得直接 ADMIN grant。
name 必填、非空白、最多 100 个字符,并且在 workspace 内忽略大小写保持唯一。description 可选(500 个字符)。defaultPlatforms 与 defaultFeatures 是可选的逗号分隔字符串(分别最多 200 和 4096 个字符),会保存供后续项目构建使用;创建时不会提交或验证构建。
defaultModuleConfiguration 保存完整的后端配置,包括目标、LTO、NOL 声明和 Structural 设置,并使用与构建相同的配置解析器校验和规范化。保存完整配置时使用此字段;NOL 对话框或分析助手中的草稿不会自动保存项目默认值。64 位 Structural seed 使用十进制字符串。
同时提供两种格式时,显式的 defaultModuleConfiguration 为准,并同步更新旧字段。后续仅提交 defaultPlatforms 或 defaultFeatures 的更新会将这些修改应用到已保存的配置,同时保留后端及无关的 NOL 声明、Structural 选项。
http
POST /api/v1/projects
Authorization: Bearer <access token>
Content-Type: application/json
{"name":"release","defaultPlatforms":"linux-x86_64","defaultFeatures":"native-llvm-direct-call"}