Cloudflare

更新 Worker

更新 Worker

PUT /cloudflare/client/v4/accounts/{account_id}/workers/workers/{worker_id}

Update a Worker. Omitted fields stay unchanged (same as PATCH).

支持状态: partial

Update a Worker. Omitted fields stay unchanged (same as PATCH).

参数

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

请求体 (application/json)

必填: true

名称类型说明
namestringWorker name, unique in your account: 3–40 lowercase letters, digits or hyphens, starting and ending with a letter or digit, with no two hyphens in a row. The names www, api, admin, app, canary, canary-probe, status, docs and console are reserved.
tagsarray<string>Replaces the tags.
observabilityobjectObservability settings.
observability.enabledbooleanCollect logs.
subdomainobjectSubdomain settings.
subdomain.enabledbooleanServe the Worker on its public subdomain.
praxisobjectPraxis settings.
praxis.labelsobjectReplaces the labels.
{
  "type": "object",
  "required": [],
  "properties": {
    "name": {
      "type": "string",
      "description": "Worker name, unique in your account: 3–40 lowercase letters, digits or hyphens, starting and ending with a letter or digit, with no two hyphens in a row. The names www, api, admin, app, canary, canary-probe, status, docs and console are reserved.",
      "pattern": "^(?!(?:www|api|admin|app|canary|canary-probe|status|docs|console)$)(?!.*--)[a-z0-9][a-z0-9-]{1,38}[a-z0-9]$",
      "example": "my-app"
    },
    "tags": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "maxItems": 8,
      "description": "Replaces the tags."
    },
    "observability": {
      "type": "object",
      "description": "Observability settings.",
      "required": [
        "enabled"
      ],
      "properties": {
        "enabled": {
          "type": "boolean",
          "description": "Collect logs."
        }
      }
    },
    "subdomain": {
      "type": "object",
      "description": "Subdomain settings.",
      "required": [
        "enabled"
      ],
      "properties": {
        "enabled": {
          "type": "boolean",
          "description": "Serve the Worker on its public subdomain."
        }
      }
    },
    "praxis": {
      "type": "object",
      "description": "Praxis settings.",
      "required": [],
      "properties": {
        "labels": {
          "type": "object",
          "additionalProperties": {
            "type": "string"
          },
          "description": "Replaces the labels."
        }
      }
    }
  }
}

响应

HTTP 200

Success

application/json

名称类型说明
successbooleanAlways true on success.
errorsarray<any>Always empty on success.
messagesarray<any>Always empty on success.
resultobject
result.idstringWorker ID, prefixed wkr_.
result.namestringUnique per account; lowercase letters, digits and single hyphens.
result.subdomainobjectPublic address of the Worker.
result.tagsarray<string>Up to 8 tags.
result.observabilityobjectObservability settings.
result.logpushbooleanAlways false: unlike Cloudflare, Logpush is not offered.
result.created_onstringWhen the Worker was created.
result.updated_onstringWhen the Worker last changed.
result.deployed_onstring | nullWhen the current deployment became active; null before the first deployment.
result.praxisobjectPlatform fields: lifecycle status, labels, and soft-delete timestamps.
result_infoobjectPresent on list responses.
result_info.pageintegerPage number.
result_info.per_pageintegerPage size.
result_info.countintegerItems on this page.
导出

本页内容