Cloudflare

创建静态资源上传会话

创建静态资源上传会话

POST /cloudflare/client/v4/accounts/{account_id}/workers/scripts/{script_name}/assets-upload-session

Declare the static file manifest; the answer lists missing hashes in batches and an upload token.

支持状态: supported

参数

名称位置类型必填说明
account_idpathstringtrueAny value; your account comes from the API key.
script_namepathstringtrueWorker name.

请求体 (application/json)

必填: true

名称类型说明
manifestobjectMap of static file path to content hash and byte size. Paths start with /; the same hash must declare the same size. The root paths /_headers and /_redirects are response-header and redirect rule files and are not served as assets; same-named files in subdirectories are ordinary assets. _headers allows at most 100 rules and 2000 characters per line (whitespace included); _redirects allows at most 2000 static and 100 dynamic rules and 1000 characters per rule (whitespace included), and rules after the first dynamic rule count toward the dynamic quota. Exceeding a limit makes CreateVersion return INVALID_PARAMS, with violations.field pointing at the manifest entry.
{
  "type": "object",
  "required": [
    "manifest"
  ],
  "properties": {
    "manifest": {
      "$ref": "#/components/schemas/cloudflare-AssetManifest"
    }
  }
}

响应

HTTP 200

Success

application/json

名称类型说明
successbooleanAlways true on success.
errorsarray<any>Always empty on success.
messagesarray<any>Always empty on success.
resultobject
result.jwtstringUpload token, valid for one hour.
result.bucketsarray<array<string>>Hashes still missing, grouped into upload batches.
result_infoobjectPresent on list responses.
result_info.pageintegerPage number.
result_info.per_pageintegerPage size.
result_info.countintegerItems on this page.
导出

本页内容