hosting
POST /v1/bulk-jobs/preview
What a bulk job would do, per site, before you confirm it.
身份验证
请将 API 密钥作为 bearer 令牌发送。该密钥必须具有 sites.view 权限;缺少该权限的密钥将被拒绝并返回 403 状态码,而非 404。
此端点不需要组织 ID。您的密钥已用于识别其所属的组织,且响应范围也仅限于该组织。
免费试用
将尖括号中的内容替换为您自己的值,并将键占位符替换为您仪表板中的一个键。
curl -X POST https://api.zinndigital.com/v1/bulk-jobs/preview \
-H "Authorization: Bearer zdk_live_…" \
-H "Content-Type: application/json" \
-d '{ "operation": <BulkOperation>, "selector": <BulkSelector> }'已登录?您仪表板中的 API 控制台会自动填入您真实的组织 ID 和您自己的密钥,并针对实时 API 运行请求,以便您查看实际的响应。 在 API 控制台中打开此端点
详细信息
Resolves a selection and answers **per site** whether the operation can run on it and, if not, why. ⭐⭐ The counts come from the *same query the job will run*, so the number you confirm cannot drift from the number that executes. A count computed a different way would be decoration. ⭐ A count alone would hide the thing that actually surprises people: six of your twelve sites may be on a platform with no shell and no `wp-cli`, so they physically cannot take an install. Learning that from the report afterwards is learning it too late, which is why `sites[]` carries a `reason` for every ineligible one. ⛔ `POST` for a **read**. Nothing is written and nothing is started. The verb is a transport decision: an explicit selection of several hundred site ids does not fit in a query string that proxies, browsers and access logs will truncate or record. Do not "correct" it to `GET`. Requires `sites.view`.
请求正文
| 名称 | 类型 | 必填 | 内容简介 |
|---|---|---|---|
operation | BulkOperation | 是 | What a bulk job does to each of its sites. ⛔ One job model with an operation discriminator, not eight job models. A selection, a frozen work-list, a durable pass and a per-site… |
selector | BulkSelector | 是 | Which sites a job targets. ⛔ There is no `all`. A job belongs to exactly one organization and `all` would span every tenant on the platform; the fleet-wide act is a staff operat… |
selector_value | string | 否 | The selector's argument — a product-line code for `product_line`, an organization id for `org`, a site-group id for `group`. Ignored for `sites`, whose members are `site_ids`. |
site_ids | Uuid[] | 否 | The explicit selection, for `selector: sites`. Every id is fenced to the organizations you can reach, so one belonging to somebody else resolves to nothing rather than to a cros… |
params | BulkJobParams | 否 | The operation's arguments. Which keys are read depends on `operation`: `plugin_install` takes `slugs` + `activate`; `plugin_activate`, `plugin_deactivate` and `plugin_remove` ta… |
响应
| 名称 | 类型 | 必填 | 内容简介 |
|---|---|---|---|
operation | BulkOperation | 是 | What a bulk job does to each of its sites. ⛔ One job model with an operation discriminator, not eight job models. A selection, a frozen work-list, a durable pass and a per-site… |
selector | BulkSelector | 是 | Which sites a job targets. ⛔ There is no `all`. A job belongs to exactly one organization and `all` would span every tenant on the platform; the fleet-wide act is a staff operat… |
selector_value | string | 是 | — |
matched | integer | 是 | How many sites the selection resolves to, **counted over the whole selection**. |
eligible | integer | 是 | How many of those the operation can actually run on — the number that will be enrolled. Counted over the whole selection, never over the listed sample: a truncated count is wors… |
listed | integer | 是 | How many rows are in `sites` (capped at 200); `matched` is the real total. |
max_sites | integer | 是 | The ceiling on one job. A larger selection is a `422`, never a silent truncation. |
confirmation_required | boolean | 是 | — |
confirmation_phrase | object | 是 | The exact phrase to send as `confirm`; `null` when none is needed. |
sites | BulkJobPreviewSite[] | 是 | — |
此端点可能返回的错误
401 · 403 · 422 · 429