跳转到内容
EN

发布画布组件库

POST /canvas/v1/canvases/{canvas_id}:publish

Freeze the reusable components of a canvas as the next numbered library version, so other canvases can use them; the first publish turns the canvas into a library. Supply a canvas_id from canvases.list or create after marking frames as components. The result lists which components were added, changed (compared by content) or removed since the previous version, and whether variables or themes changed. A removed component stays readable in the new version, marked removed. Publishing is not an edit, so the canvas version does not change. Component libraries are available only to organizations where the canvas-libraries feature is enabled; others receive FEATURE_DISABLED.

支持状态: supported

参数

名称位置类型必填说明
canvas_idpathstringtrueCanvas id returned by create or list, in the form cvs_ followed by 16 lowercase letters or digits; a display name is not accepted.

请求体 (application/json)

必填: false

名称类型说明
descriptionstringRelease note shown in library_versions, at most 2000 characters; empty when omitted.
expected_versionstringCurrent canvas version from retrieve or nodes.list; the publish is refused with REVISION_CONFLICT if the canvas has moved on. Omission publishes whatever is current.
{
"type": "object",
"properties": {
"description": {
"type": "string",
"maxLength": 2000,
"description": "Release note shown in library_versions, at most 2000 characters; empty when omitted."
},
"expected_version": {
"type": "string",
"pattern": "^[0-9]+$",
"example": "12",
"description": "Current canvas version from retrieve or nodes.list; the publish is refused with REVISION_CONFLICT if the canvas has moved on. Omission publishes whatever is current."
}
}
}

响应

HTTP 200

The new library version and what it changed relative to the previous one.

application/json

名称 类型 说明
version string The new library version, counting from 1; importing canvases pin to it.
canvas_version string The canvas version this library version was taken from; publishing leaves it unchanged.
added array<object> Components that did not exist in the previous library version.
added[].id string Node id of the component's root frame in the library canvas.
added[].name string The component's name, or its id when it has no name.
changed array<object> Components whose content differs from the previous library version.
changed[].id string Node id of the component's root frame in the library canvas.
changed[].name string The component's name, or its id when it has no name.
removed array<object> Components the previous library version had and this canvas no longer has; they stay in the new version marked removed.
removed[].id string Node id of the component's root frame in the library canvas.
removed[].name string The component's name, or its id when it has no name.
variables_changed boolean True when the canvas variables or themes differ from the previous library version; always false for the first version.
component_count integer Number of components in this version, not counting removed ones.
published_at string ISO 8601 time at which this version was published.