提交项目构建

OpenAPI 契约

方法
POST
路径
/api/v1/projects/{id}/builds
认证
jwtBearer (bearer) OR automationKey (bearer)
响应状态
202 400 401 402 403 404 409 413 429 500
请求与响应 Schema
JSON
{
  "requestBody": {},
  "responses": {
    "202": {
      "description": "Build accepted",
      "content": {
        "application/json": {
          "$ref": "#/components/schemas/CompileTaskResponse"
        }
      }
    },
    "400": {
      "description": "Invalid request",
      "content": {
        "application/json": {
          "$ref": "#/components/schemas/RequestError"
        }
      }
    },
    "401": {
      "description": "Authentication required or invalid",
      "content": {
        "application/json": {
          "$ref": "#/components/schemas/SecurityError"
        }
      }
    },
    "402": {
      "description": "Insufficient NCU balance",
      "content": {
        "application/json": {
          "$ref": "#/components/schemas/ApiError"
        }
      }
    },
    "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"
        }
      }
    },
    "413": {
      "description": "Upload or expanded archive exceeds a configured limit",
      "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/{id}/builds 是非幂等的 multipart 操作,可由 JWT 或同时具有 project:write 与 build:write 的 nfy_ 密钥调用。调用方必须对项目拥有有效 build:write capability,归档 workspace 会拒绝提交。提供 processorId 时,automation key 还需要 processor:read。该操作复用这个项目中较早构建保留的最新源 JAR;不接受文件。如果该源缺失或不可用,提交会失败。

对于 platforms,请求值优先,其次是 defaultPlatforms,最后是服务回退值。对于 features,请求值优先,其次是调用方拥有的 processorId preset,再是 defaultFeatures,最后是服务回退值。因此显式 feature 会覆盖 processor preset。skipIrOpt 默认是 false;hostingPath 可选。usage 计入项目 organization billing owner。不要自动重试此 POST。

http
POST /api/v1/projects/{id}/builds
Authorization: Bearer <access token>
Content-Type: multipart/form-data

platforms=linux-x86_64
processorId=<owned processor UUID>