hosting
POST /v1/sites/{siteId}/quota/resources/{resource}/upgrade
Buy more disk or file allowance for one site.
身份验证
请将 API 密钥作为 bearer 令牌发送。该密钥必须具有 sites.view 权限;缺少该权限的密钥将被拒绝并返回 403 状态码,而非 404。
此端点不需要组织 ID。您的密钥已用于识别其所属的组织,且响应范围也仅限于该组织。
免费试用
将尖括号中的内容替换为您自己的值,并将键占位符替换为您仪表板中的一个键。
curl -X POST https://api.zinndigital.com/v1/sites/{siteId}/quota/resources/{resource}/upgrade \
-H "Authorization: Bearer zdk_live_…" \
-H "Content-Type: application/json" \
-d '{ "steps": <integer> }'已登录?您仪表板中的 API 控制台会自动填入您真实的组织 ID 和您自己的密钥,并针对实时 API 运行请求,以便您查看实际的响应。 在 API 控制台中打开此端点
详细信息
Raises this site's ceiling by `steps` purchasable steps (1 GB of disk, 50,000 inodes) and applies it to the box. Recorded as an open-ended grant rather than by editing the base, so *what the site started with* and *what the customer bought* stay separately revocable. ⛔⛔ **The charge is created BEFORE the ceiling is raised, and an upgrade that cannot be charged for is refused with `422` — no grant, nothing on the box.** Both refusals answer `422` and the body distinguishes them: no published price in the caller's currency, or no way to take the payment. Free capacity on a real box is the failure no customer reports, because they received what they asked for. Charge-then-apply is deliberate: a charged-but-unapplied upgrade is repaired by the ten-minute reconciler, and free capacity is repaired by nobody. An upgrade also **lifts a quota freeze immediately**, because paying is the remedy and waiting for a sweep would be the worst minute of the product to leave to a schedule. Requires `sites.view` **and** `hosting.quota.manage` — an upgrade commits the organisation to a recurring charge, which is a money authority rather than a hosting one.
参数
| 名称 | 类型 | 必填 | 内容简介 |
|---|---|---|---|
siteId (path) | Uuid | 是 | Site ID (UUIDv7). |
resource (path) | string<disk, inodes> | 是 | Which metered per-site resource. Only resources the platform actually enforces are addressable — `bandwidth` is modelled and priceable in admin but nothing measures or enforces… |
请求正文
| 名称 | 类型 | 必填 | 内容简介 |
|---|---|---|---|
steps | integer | 是 | How many purchasable steps to add. |
响应
| 名称 | 类型 | 必填 | 内容简介 |
|---|---|---|---|
resource | string<disk, inodes, bandwidth> | 是 | — |
unit | SiteQuotaUnit | 是 | The unit a quota's figures are expressed in, as a **code the client localises** — never a word to render raw. `GB` for disk and bandwidth, `files` for inodes. ⛔ This was an unco… |
step | integer | 是 | One purchasable step, in `unit`. A customer buys N of these, never an arbitrary size. |
base | number | 是 | The site's own allowance, copied from the product line's admin-set default when the site was provisioned. `null` means this site has no limit row yet — it has not been through p… |
granted | number | 是 | Extra from grants live right now — staff gestures and purchased upgrades, added together. |
total | number | 是 | The effective ceiling — `base + granted`. `null` when `base` is null. |
used | number | 是 | Measured usage. `null` means **unknown** — the box was unreachable, or nothing has sampled it yet — and never `0`. A client must render those differently. |
percent | integer | 是 | Usage as a whole percentage of `total`, or `null` when either is unknown. |
measured_at | string | 是 | When the box was last asked. **Render the age.** A bar drawn from a two-day-old reading looks identical to one drawn a minute ago, and the customer cannot tell. |
reverts_at | string | 是 | When the ceiling next **drops**, because a temporary grant expires. `null` when no live grant has an expiry. A customer whose limit is about to fall needs to know before it does. |
warn_at_percent | integer[] | 是 | The thresholds at which the platform notifies the customer, ascending. |
price_minor | integer | 是 | Cost of ONE step, in integer minor units of `price_currency`, NET of tax. `null` means no price is published in the caller's currency — the client must then show no upgrade cont… |
price_currency | string | 是 | — |
price_interval | string<monthly, yearly> | 是 | — |
此端点可能返回的错误
401 · 403 · 404 · 422 · 429