Application

创建 Worker

创建 Worker

POST /application/v1/workers

Create a Worker. It serves nothing until a version is deployed.

支持状态: supported

请求体 (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>Up to 8 tags.
observabilityobjectObservability settings.
observability.enabledbooleanCollect logs.
subdomainobjectSubdomain settings.
subdomain.enabledbooleanServe the Worker on its public subdomain (default true).
praxisobjectPraxis settings.
praxis.labelsobjectUp to 16 labels.
{
  "type": "object",
  "required": [
    "name"
  ],
  "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": "Up to 8 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 (default true)."
        }
      }
    },
    "praxis": {
      "type": "object",
      "description": "Praxis settings.",
      "required": [],
      "properties": {
        "labels": {
          "type": "object",
          "additionalProperties": {
            "type": "string"
          },
          "description": "Up to 16 labels."
        }
      }
    }
  }
}

响应

HTTP 200

Success

application/json

名称类型说明
idstringWorker ID, prefixed wkr_.
namestringUnique per account; lowercase letters, digits and single hyphens.
subdomainobjectPublic address of the Worker.
subdomain.enabledbooleanWhether the public subdomain serves this Worker.
subdomain.urlstringPublic URL of the Worker.
tagsarray<string>Up to 8 tags.
observabilityobjectObservability settings.
observability.enabledbooleanWhether logs are collected.
logpushbooleanAlways false: unlike Cloudflare, Logpush is not offered.
created_onstringWhen the Worker was created.
updated_onstringWhen the Worker last changed.
deployed_onstring | nullWhen the current deployment became active; null before the first deployment.
praxisobjectPlatform fields: lifecycle status, labels, and soft-delete timestamps.
praxis.statusstringWorker status: draft (no deployment yet), active (serving), suspended (stopped by an administrator), deleted (soft-deleted, restorable for 7 days), purging (resources being removed), purged (gone).
praxis.current_deployment_idstring | nullID of the active deployment.
praxis.labelsobjectUp to 16 key-value labels for your own grouping.
praxis.deleted_onstring | nullWhen the Worker was deleted.
praxis.purge_onstring | nullWhen a deleted Worker is permanently removed.
praxis.suspended_reasonstring | nullWhy an administrator suspended the Worker.
导出

本页内容