接口详情

GET /v1/admin/themes

operationId
listThemes
认证
  • 登录会话:主控登录后的 Bearer 会话,由客户本人在自己的主控里使用;插件不能要求客户交出会话。
所需权限

契约没有单独标注权限码,权限要求见下方说明与 403 响应。

说明(契约原文)

Catalog themes with download state and the downloaded packages. Requires system_configuration.read.

响应

listThemes 响应
状态码说明
200Catalog

字段:schema: const cdnca.theme.catalog/v1 activation_revision: integer active_package_sha256: string user_package_sha256: string user_follows_admin: boolean available: array<object> packages: array<Package> error_page_republication: ErrorPageRepublication

401Unauthenticated
403Permission denied

失败时怎么办

  • 401 检查凭据格式、是否过期或被轮换。
  • 403 检查 Key 范围与所有者当前权限、当前租户作用域;不要换更高权限账号绕过。

↑ 回到列表

POST /v1/admin/themes/catalog/{theme_id}/download

operationId
downloadTheme
认证
  • 登录会话:主控登录后的 Bearer 会话,由客户本人在自己的主控里使用;插件不能要求客户交出会话。
所需权限

契约没有单独标注权限码,权限要求见下方说明与 403 响应。

说明(契约原文)

Store a catalog theme (downloaded, not active). Requires system_configuration.manage.

参数

downloadTheme 参数
名称位置类型必填说明
theme_idpathstring是—

响应

downloadTheme 响应
状态码说明
200Downloaded package

字段:package_sha256: string theme_id: string version: string name: object description?: object source: any requires_feature?: string downloaded_at: string(date-time) active: boolean tokens_url: string stylesheet_url: string preview_url?: string derived_from?: object

404Unknown catalog theme

失败时怎么办

  • 404 资源不存在或不属于当前租户。

↑ 回到列表

POST /v1/admin/themes/packages

operationId
uploadTheme
认证
  • 登录会话:主控登录后的 Bearer 会话,由客户本人在自己的主控里使用;插件不能要求客户交出会话。
所需权限

契约没有单独标注权限码,权限要求见下方说明与 403 响应。

说明(契约原文)

Upload a custom cdnca.theme/v1 package (id custom.*). Packages with url(), @import, external links, script or undeclared classes are refused.

请求体

application/json · 必填:是

响应

uploadTheme 响应
状态码说明
201Downloaded package

字段:package_sha256: string theme_id: string version: string name: object description?: object source: any requires_feature?: string downloaded_at: string(date-time) active: boolean tokens_url: string stylesheet_url: string preview_url?: string derived_from?: object

413Larger than 8 MiB
422Refused package

↑ 回到列表

GET /v1/admin/themes/packages/{sha}

operationId
getThemePackage
认证
  • 登录会话:主控登录后的 Bearer 会话,由客户本人在自己的主控里使用;插件不能要求客户交出会话。
所需权限

契约没有单独标注权限码,权限要求见下方说明与 403 响应。

说明(契约原文)

The cdnca.theme/v1 JSON of a package this installation stored (removed ones too) or a catalog theme, byte for byte (its SHA-256 is the path digest). The theme management page edits a copy of it and uploads the copy as a custom.* package whose derived_from names this package. Requires system_configuration.read.

参数

getThemePackage 参数
名称位置类型必填说明
shapathstring是—

响应

getThemePackage 响应
状态码说明
200Package JSON
404Never stored and not in the catalog

失败时怎么办

  • 404 资源不存在或不属于当前租户。

↑ 回到列表

DELETE /v1/admin/themes/packages/{sha}

operationId
removeTheme
认证
  • 登录会话:主控登录后的 Bearer 会话,由客户本人在自己的主控里使用;插件不能要求客户交出会话。
所需权限

契约没有单独标注权限码,权限要求见下方说明与 403 响应。

参数

removeTheme 参数
名称位置类型必填说明
shapathstring是—

响应

removeTheme 响应
状态码说明
204Removed (can be downloaded again)
409The active package, or one a tenant uses (theme_package_selected_by_tenant), cannot be removed

失败时怎么办

  • 409 先回读资源当前状态;同一操作重试保持原 Idempotency-Key 和原请求内容。

↑ 回到列表

POST /v1/admin/themes/packages/{sha}/activate

operationId
activateTheme
认证
  • 登录会话:主控登录后的 Bearer 会话,由客户本人在自己的主控里使用;插件不能要求客户交出会话。
所需权限

契约没有单独标注权限码,权限要求见下方说明与 403 响应。

说明(契约原文)

Make a downloaded package the active theme of one console: no body is both consoles as before; {"slot":"admin"|"user"|"all"} names one. The admin console (admin, all) takes official themes only (built in, uploads and copies, or the io.cdnca market namespace); a third party's market theme is a user console theme. An admin activation records a new error page publication revision pinned to the theme; node default error pages follow the admin console, so a user activation republishes nothing.

参数

activateTheme 参数
名称位置类型必填说明
shapathstring是—
If-Matchheaderstring是Activation revision the caller saw ("0" before any).

请求体

application/json · 必填:否

activateTheme 请求体
名称类型必填说明
slotstring: all / admin / user否—

响应

activateTheme 响应
状态码说明
200Activated

字段:revision: integer package_sha256: string theme_id: string error_page_publication_revision: integer error_page_republish_scopes: integer already_active?: boolean

400Unknown slot
403Permission denied
404Not downloaded
412Revision conflict

失败时怎么办

  • 400 按字段说明修正参数或请求体再发;不要原样重试。
  • 403 检查 Key 范围与所有者当前权限、当前租户作用域;不要换更高权限账号绕过。
  • 404 资源不存在或不属于当前租户。
  • 412 版本已变:回读最新 ETag 后重新判断,再带新的 If-Match 提交。

↑ 回到列表

GET /v1/admin/themes/tenant-policy

operationId
getTenantThemePolicy
认证
  • 登录会话:主控登录后的 Bearer 会话,由客户本人在自己的主控里使用;插件不能要求客户交出会话。
所需权限

契约没有单独标注权限码,权限要求见下方说明与 403 响应。

响应

getTenantThemePolicy 响应
状态码说明
200Platform default

字段:tenant_selection_allowed: boolean revision: integer

↑ 回到列表

PUT /v1/admin/themes/tenant-policy

operationId
updateTenantThemePolicy
认证
  • 登录会话:主控登录后的 Bearer 会话,由客户本人在自己的主控里使用;插件不能要求客户交出会话。
所需权限

契约没有单独标注权限码,权限要求见下方说明与 403 响应。

说明(契约原文)

Whether tenants in inherit mode may choose their theme. Audited as theme.tenant_policy.update.

参数

updateTenantThemePolicy 参数
名称位置类型必填说明
If-Matchheaderstring是—

请求体

application/json · 必填:是

updateTenantThemePolicy 请求体
名称类型必填说明
tenant_selection_allowedboolean是—

响应

updateTenantThemePolicy 响应
状态码说明
200New policy

字段:tenant_selection_allowed: boolean revision: integer

412theme_revision_conflict

失败时怎么办

  • 412 版本已变:回读最新 ETag 后重新判断,再带新的 If-Match 提交。

↑ 回到列表

GET /v1/admin/themes/tenants/{tenant_scope_id}

operationId
getTenantThemeForPlatform
认证
  • 登录会话:主控登录后的 Bearer 会话,由客户本人在自己的主控里使用;插件不能要求客户交出会话。
所需权限

契约没有单独标注权限码,权限要求见下方说明与 403 响应。

参数

getTenantThemeForPlatform 参数
名称位置类型必填说明
tenant_scope_idpathstring(uuid)是—

响应

getTenantThemeForPlatform 响应
状态码说明
200Tenant theme

字段:schema: const cdnca.theme.tenant/v1 tenant_scope_id: string(uuid) selection_mode: any platform_allows: boolean selection_allowed: boolean selected_package_sha256?: string assigned_by?: any effective_package_sha256: string effective_theme_id: string follows_platform: boolean revision: integer domains: array<string> choices: array<object>

404Unknown tenant scope

失败时怎么办

  • 404 资源不存在或不属于当前租户。

↑ 回到列表

PUT /v1/admin/themes/tenants/{tenant_scope_id}

operationId
updateTenantThemeForPlatform
认证
  • 登录会话:主控登录后的 Bearer 会话,由客户本人在自己的主控里使用;插件不能要求客户交出会话。
所需权限

契约没有单独标注权限码,权限要求见下方说明与 403 响应。

说明(契约原文)

Set the tenant's selection_mode (inherit | allow | deny) and, with assign, the theme the platform assigns it (package_sha256 "" clears the assignment). An assigned theme applies whatever the selection mode. Audited as theme.tenant.activate (assign) or theme.tenant.selection_update.

参数

updateTenantThemeForPlatform 参数
名称位置类型必填说明
tenant_scope_idpathstring(uuid)是—
If-Matchheaderstring是—

请求体

application/json · 必填:是

updateTenantThemeForPlatform 请求体
名称类型必填说明
selection_modeany是—
assignboolean否—
package_sha256string否Required exactly when assign is true

响应

updateTenantThemeForPlatform 响应
状态码说明
200New tenant theme

字段:schema: const cdnca.theme.tenant/v1 tenant_scope_id: string(uuid) selection_mode: any platform_allows: boolean selection_allowed: boolean selected_package_sha256?: string assigned_by?: any effective_package_sha256: string effective_theme_id: string follows_platform: boolean revision: integer domains: array<string> choices: array<object>

412theme_revision_conflict

失败时怎么办

  • 412 版本已变:回读最新 ETag 后重新判断,再带新的 If-Match 提交。

↑ 回到列表

PUT /v1/admin/themes/tenants/{tenant_scope_id}/domains/{hostname}

operationId
bindTenantThemeDomain
认证
  • 登录会话:主控登录后的 Bearer 会话,由客户本人在自己的主控里使用;插件不能要求客户交出会话。
所需权限

契约没有单独标注权限码,权限要求见下方说明与 403 响应。

说明(契约原文)

Bind a sign-in hostname to the tenant (its sign-in page shows the tenant theme). Audited as theme.tenant_domain.bind.

参数

bindTenantThemeDomain 参数
名称位置类型必填说明
tenant_scope_idpathstring(uuid)是—
hostnamepathstring是—

响应

bindTenantThemeDomain 响应
状态码说明
200Tenant theme

字段:schema: const cdnca.theme.tenant/v1 tenant_scope_id: string(uuid) selection_mode: any platform_allows: boolean selection_allowed: boolean selected_package_sha256?: string assigned_by?: any effective_package_sha256: string effective_theme_id: string follows_platform: boolean revision: integer domains: array<string> choices: array<object>

409theme_domain_conflict (bound to another tenant)

失败时怎么办

  • 409 先回读资源当前状态;同一操作重试保持原 Idempotency-Key 和原请求内容。

↑ 回到列表

DELETE /v1/admin/themes/tenants/{tenant_scope_id}/domains/{hostname}

operationId
unbindTenantThemeDomain
认证
  • 登录会话:主控登录后的 Bearer 会话,由客户本人在自己的主控里使用;插件不能要求客户交出会话。
所需权限

契约没有单独标注权限码,权限要求见下方说明与 403 响应。

参数

unbindTenantThemeDomain 参数
名称位置类型必填说明
tenant_scope_idpathstring(uuid)是—
hostnamepathstring是—

响应

unbindTenantThemeDomain 响应
状态码说明
200Tenant theme

字段:schema: const cdnca.theme.tenant/v1 tenant_scope_id: string(uuid) selection_mode: any platform_allows: boolean selection_allowed: boolean selected_package_sha256?: string assigned_by?: any effective_package_sha256: string effective_theme_id: string follows_platform: boolean revision: integer domains: array<string> choices: array<object>

404Not bound

失败时怎么办

  • 404 资源不存在或不属于当前租户。

↑ 回到列表