提交构建

OpenAPI 契约

方法
POST
路径
/api/v1/builds
认证
jwtBearer (bearer) OR automationKey (bearer)
响应状态
202 400 401 402 403 404 409 413 429 500
请求与响应 Schema
JSON
{
  "requestBody": {
    "multipart/form-data": {
      "properties": {
        "file": {
          "description": "Input JAR or ZIP archive",
          "format": "binary",
          "type": "string"
        }
      },
      "required": [
        "file"
      ],
      "type": "object"
    }
  },
  "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 build was not found",
      "content": {
        "application/json": {
          "$ref": "#/components/schemas/ApiError"
        }
      }
    },
    "409": {
      "description": "Request conflicts with current build 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"
        }
      }
    }
  }
}

上传一个 .jar 或 .zip,创建并排队一个构建。需要 JWT 或带 build:write 的 nfy_ 密钥。提供 projectId 时,需要对项目拥有有效 build:write capability,并且 workspace 必须处于 active 状态;automation key 还需要 project:write。只要提供 processorId,automation key 就需要 processor:read,而 preset 仍必须归调用方所有。没有项目时,构建使用调用方的个人 workspace 和 exact-owner fallback。这是非幂等 POST:重试可能再次创建任务并再次预留额度。应使用返回的任务 URL 观察原请求,而不是重放提交。

请求可提供目标平台、功能名、skipIrOpt、可选项目/预设 ID 及可选 hostingPath。空平台按请求、项目默认值、服务回退值依次解析。空功能按请求、所选处理器预设、项目默认值、服务回退值依次解析。

每个构建都会获得私有 hosted 路径。未指定自定义值时为 artifacts/{taskId}/native.jar;hostingPath 只改变路由地址,不改变授权。任务响应携带 hostingPath,请自行在 /api/v1/hosted/ 下构造路由。获取时接受 dashboard JWT 或带 artifact:read 的 nfy_ 密钥,然后要求 project task 具有有效 artifact:output:read,legacy/ad-hoc task 则要求 exact ownership。上传校验、无效选项、未知 feature、资源授权失败、队列限制、额度预留或调度容量都可能阻止受理。

http
Authorization: Bearer <token>
Content-Type: multipart/form-data
[email protected]
features=flattening