hosting

PUT /v1/sites/{siteId}/wordpress/update-policy

Set the site's auto-update policy and apply it to WordPress.

所有 hosting 端点

身份验证

请将 API 密钥作为 bearer 令牌发送。该密钥必须具有 sites.view 权限;缺少该权限的密钥将被拒绝并返回 403 状态码,而非 404。

此端点不需要组织 ID。您的密钥已用于识别其所属的组织,且响应范围也仅限于该组织。

免费试用

将尖括号中的内容替换为您自己的值,并将键占位符替换为您仪表板中的一个键。

curl -X PUT https://api.zinndigital.com/v1/sites/{siteId}/wordpress/update-policy \
  -H "Authorization: Bearer zdk_live_…" \
  -H "Content-Type: application/json" \
  -d '{ "core": <string<off, minor, all>>, "plugins": <boolean>, "themes": <boolean>, "ring": <string<canary, early, general>> }'

已登录?您仪表板中的 API 控制台会自动填入您真实的组织 ID 和您自己的密钥,并针对实时 API 运行请求,以便您查看实际的响应。 在 API 控制台中打开此端点

详细信息

Stores the policy **and writes it to the site in the same call**, then re-reads the site and returns what it found. ⛔ Storing without applying is the defect this endpoint exists to avoid: a stored row saying `core: off` over a WordPress that is still updating itself is worse than no row, because the screen then says the operator's decision took effect. The response body is a fresh read, never an echo of the request. ⛔ On a failed apply the policy row keeps `apply_error` **and** the call answers `422`. Only recording it would be a silent failure; only raising it would leave a stored policy nobody knows was never applied. `ring` is the **staged-rollout** ring this site belongs to — `canary`, `early` or `general`. It is a property of the site, not of the change, so an operator picks their canaries once and every later rollout inherits the choice. ⛔ **Fleet only** — refused where `wp_update_policy` is `false`, because it is written with `wp config set` and `wp plugin auto-updates` and this platform publishes no equivalent. Requires `sites.view` and `sites.panel_access`.

参数

名称类型必填内容简介
siteId (path)UuidSite ID (UUIDv7).

请求正文

名称类型必填内容简介
corestring<off, minor, all>`minor` is WordPress's own default (security and maintenance releases); `all` includes major upgrades unattended; `off` disables core auto-updates.
pluginsbooleanWhether every plugin should auto-update.
themesbooleanWhether every theme should auto-update.
ringstring<canary, early, general>The staged-rollout ring this site belongs to.

响应

名称类型必填内容简介
corestring<off, minor, all>The stored policy for WordPress core updates.
pluginsbooleanThe stored policy — whether every plugin should auto-update.
themesbooleanThe stored policy — whether every theme should auto-update.
ringstring<canary, early, general>The staged-rollout ring this site belongs to.
applied_atstringWhen the policy last reached the site, ISO-8601, or `""` if it never has. ⛔ A timestamp and not a flag: "when did this last reach the site" is the question an operator asks, and…
apply_errorstringWhy the last apply failed, or `""`. Kept beside `applied_at` rather than replacing it, so a failed re-apply does not erase that an earlier one worked.
observed_readbooleanWhether the site itself was read. ⛔ An empty `drift` is only meaningful while this is `true`.
observed_corestringWhat `WP_AUTO_UPDATE_CORE` is set to on the site — `off`, `minor`, `all`, or `""` meaning **the constant is not defined at all**, so WordPress applies its own default. ⛔ `""` is…
plugins_offstring[]The plugins on this site that are NOT auto-updating.
themes_offstring[]The themes on this site that are NOT auto-updating.
driftstring<core, plugins, themes>[]Which of `core`, `plugins`, `themes` the site disagrees with the policy about.

此端点可能返回的错误

401 · 403 · 404 · 422 · 429 · 503