跳转到内容
EN

创建部署

POST /cloudflare/client/v4/accounts/{account_id}/workers/scripts/{script_name}/deployments

Deploy one version at 100 percent (no gradual rollout). Deployment is asynchronous; read praxis.status.

支持状态: partial

Deploy one version at 100 percent (no gradual rollout). Deployment is asynchronous; read praxis.status.

参数

名称位置类型必填说明
account_idpathstringtrueAny value; your account comes from the API key.
script_namepathstringtrueWorker name.
forcequerybooleanfalseDeploy even if the last deployment changed in between.

请求体 (application/json)

必填: true

名称类型说明
strategystringRollout strategy.
versionsarray<object>Exactly one version at 100 percent.
versions[].version_idstringVersion to deploy.
versions[].percentagenumberMust be 100.
forcebooleanOwn face only; on the compatible face use the force query parameter.
annotationsobjectFree-form annotations.
annotations.workers/messagestringDeployment message.
{
"type": "object",
"required": [
"strategy",
"versions"
],
"properties": {
"strategy": {
"type": "string",
"description": "Rollout strategy.",
"enum": [
"percentage"
],
"x-enum-descriptions": {
"percentage": "Split traffic by percentage; only a single version at 100 is accepted."
},
"example": "percentage"
},
"versions": {
"type": "array",
"description": "Exactly one version at 100 percent.",
"items": {
"type": "object",
"required": [
"version_id",
"percentage"
],
"properties": {
"version_id": {
"type": "string",
"description": "Version to deploy."
},
"percentage": {
"type": "number",
"description": "Must be 100."
}
}
}
},
"force": {
"type": "boolean",
"description": "Own face only; on the compatible face use the force query parameter."
},
"annotations": {
"type": "object",
"description": "Free-form annotations.",
"required": [],
"properties": {
"workers/message": {
"type": "string",
"description": "Deployment message."
}
}
}
}
}

响应

HTTP 200

Success

application/json

名称 类型 说明
success boolean Always true on success.
errors array<any> Always empty on success.
messages array<any> Always empty on success.
result object
result.id string Deployment ID, prefixed dep_.
result.created_on string When the deployment was created.
result.source string Origin: api, sdk, console or rollback.
result.strategy string Rollout strategy.
result.versions array<object> Exactly one version at 100 percent.
result.annotations object Free-form annotations.
result.author_email string | null Who created the deployment.
result.praxis object Platform fields: deployments run asynchronously, so track status, progress and error here.
result_info object Present on list responses.
result_info.page integer Page number.
result_info.per_page integer Page size.
result_info.count integer Items on this page.