hosting
PUT /v1/sites/{siteId}/media-offload
Turn media offload on for a site, or change how it behaves.
身份验证
请将 API 密钥作为 bearer 令牌发送。该密钥必须具有 storage.manage 权限;缺少该权限的密钥将被拒绝并返回 403 状态码,而非 404。
此端点不需要组织 ID。您的密钥已用于识别其所属的组织,且响应范围也仅限于该组织。
免费试用
将尖括号中的内容替换为您自己的值,并将键占位符替换为您仪表板中的一个键。
curl -X PUT https://api.zinndigital.com/v1/sites/{siteId}/media-offload \
-H "Authorization: Bearer zdk_live_…" \
-H "Content-Type: application/json" \
-d '{ }'已登录?您仪表板中的 API 控制台会自动填入您真实的组织 ID 和您自己的密钥,并针对实时 API 运行请求,以便您查看实际的响应。 在 API 控制台中打开此端点
详细信息
Creates the offload configuration if it does not exist, provisioning storage for the organisation on first use — "turn on media offload" is what the customer wants, and a bucket is our word for part of how we do it. Moving an offload that is already live to a **different** bucket answers `422`. The objects already written stay where they are, so the switch would leave the site serving half its media from a bucket the configuration no longer names, and nothing would report it because new uploads would keep succeeding. Requires `storage.manage`.
参数
| 名称 | 类型 | 必填 | 内容简介 |
|---|---|---|---|
siteId (path) | Uuid | 是 | Site ID (UUIDv7). |
请求正文
| 名称 | 类型 | 必填 | 内容简介 |
|---|---|---|---|
bucket_id | string | 否 | Which bucket to use. Omit to use the organisation's own, provisioning one on first use. Changing this on a live offload is refused. |
enabled | boolean | 否 | Pause or resume a paired site. Ignored before the plugin has paired. |
rewrite_urls | boolean | 否 | — |
delete_local | boolean | 否 | — |
prefix | string | 否 | — |
custom_domain | string | 否 | A media domain of the site's own, replacing the shared Zinn® hostname. Must be `https://` and a bare domain with no path. Send `""` to clear it. Required to turn on URL rewritin… |
响应
| 名称 | 类型 | 必填 | 内容简介 |
|---|---|---|---|
configured | boolean | 是 | `false` when this site has no offload set up. The rest of the fields are then absent. A site with no offload is a `200`, never a `404`. |
id | string | 否 | — |
site_id | string | 否 | — |
bucket_id | string | 否 | — |
status | string<awaiting_pairing, active, paused, revoked> | 否 | — |
prefix | string | 否 | The key prefix this site's objects live under. |
rewrite_urls | boolean | 否 | Whether the plugin points media URLs at the bucket. Off means "upload a copy but keep serving locally", which is how a cautious customer migrates. |
delete_local | boolean | 否 | Whether the plugin removes the local file after a confirmed upload. Defaults to off, and even when on the plugin refuses to delete after a partial upload. |
custom_domain | string | 否 | The site's OWN media domain, as the customer typed it, or `""`. This is what belongs in the settings input box. See `public_base_url` for where media is actually served from — t… |
public_base_url | string | 否 | Where this site's media is actually served from, after the site's own domain, the footprint rule and the bucket's shared hostname have been resolved. `""` means no URL is rewrit… |
needs_custom_domain | boolean | 否 | `true` when this site is serving media locally only because it has no media domain of its own — a footprint-free site awaiting a CNAME. Distinguishes the one empty-`public_base_… |
accepts_uploads | boolean | 否 | Whether the plugin may currently upload. Requires both an active offload and a usable bucket. |
paired | boolean | 否 | Whether a plugin token has been issued. The token and its hash are never returned. |
plugin_version | string | 否 | — |
last_seen_at | string | 否 | When the plugin last called. `null` means it never has. |
objects_offloaded | integer | 否 | What the plugin reports it has moved. A diagnostic for the screen, never an input to billing — storage is metered by measuring the bucket. |
bytes_offloaded | integer | 否 | — |
created_at | string | 否 | — |
此端点可能返回的错误
401 · 403 · 404 · 422 · 429