canvas_patch
Edit an existing json (JSON Render) canvas artifact element by element instead of resending the whole spec. Use it for every change to a json dashboard already on the canvas: name the artifact_id canvas_present returned and send only the operations that change it. Operations run in order: {"op":"set","id","element":{type, props, children?}} replaces an existing element (its children are kept when element omits them); {"op":"insert","id","parent","index"?,"element"} adds a new element under parent (appended when index is omitted); {"op":"remove","id"} deletes an element and the part of its subtree nothing else uses; {"op":"move","id","parent","index"?} re-parents an element. Keep element ids stable: reuse the ids already in the spec, add new ids only for new elements, and never rename or renumber existing ones. An element is one of canvas_present's json components with the same strict props, including binding (a dataset from list_canvas_datasets), Grid layout, LineChart annotations and Stat sparkline. time ({default, options, compare?}) and filters ([{name, label, default?}]) replace the dashboard's time control and filters and make it schema_version 2, which binding, layout, annotations and sparkline need: send time with the first patch that adds one to a v1 dashboard. To turn an inline panel live, set it with a binding; to place panels, set the Grid with its layout. The result is checked like a saved canvas (at most 128 elements and 12 levels, ids start with a letter, every child declared, no cycles); an invalid patch is refused with the exact problems and nothing changes: fix them and call once more. When the artifact is saved in the canvas library, pass base_revision_id (the revision_id your last patch returned, or current_revision_id from a refusal); if the user changed the canvas since, the call is refused with the current revision and its content to re-read. Only json artifacts can be patched: for html, svg or markdown send the complete content with canvas_present.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| time | No | Replaces the dashboard's time control, e.g. {"default":"24h","options":["1h","6h","24h","7d","30d"],"compare":false}. | |
| title | No | A new artifact title; omit to keep the current one. | |
| filters | No | Replaces the dashboard's filters, e.g. [{"name":"cluster","label":"Cluster"}]. | |
| operations | No | Element operations, applied in order. | |
| artifact_id | Yes | The artifact_id of the json artifact to edit, as canvas_present returned it. | |
| base_revision_id | No | Only for an artifact saved in the canvas library: the revision this patch edits (the revision_id the last patch returned, or current_revision_id from a refusal). |