enhancedocs
For agentsOpen Enhance
Reference / canvas.render.importSource

Enhance documentation

canvas.render.importSource

Import one source through the canonical editable-primitives compiler.

Markdown

canvas.render.importSource

mutation write

Use when the requested change exactly matches canvas.render.importSource; read the current state first when a version or identifier may have changed.

Before calling

  • Authenticate as the accountable Enhance person.
  • Use only resource identifiers returned by an earlier capability result or supplied by the person.
  • Reuse clientToken only when retrying this exact mutation input.

Input

Show complete JSON Schema
{
 "$schema": "https://json-schema.org/draft/2020-12/schema",
 "allOf": [
  {
   "type": "object",
   "properties": {
    "source": {
     "oneOf": [
      {
       "type": "object",
       "properties": {
        "kind": {
         "type": "string",
         "const": "screen"
        },
        "nodeId": {
         "type": "string",
         "minLength": 1,
         "maxLength": 200
        }
       },
       "required": [
        "kind",
        "nodeId"
       ],
       "additionalProperties": false
      },
      {
       "type": "object",
       "properties": {
        "kind": {
         "type": "string",
         "const": "html"
        },
        "html": {
         "type": "string",
         "minLength": 1,
         "maxLength": 262144
        },
        "label": {
         "type": "string",
         "minLength": 1,
         "maxLength": 500
        },
        "idPrefix": {
         "type": "string",
         "minLength": 1,
         "maxLength": 80,
         "pattern": "^[\\w-]+$"
        }
       },
       "required": [
        "kind",
        "html",
        "label"
       ],
       "additionalProperties": false
      }
     ]
    },
    "destination": {
     "oneOf": [
      {
       "type": "object",
       "properties": {
        "kind": {
         "type": "string",
         "const": "adjacent"
        }
       },
       "required": [
        "kind"
       ],
       "additionalProperties": false
      },
      {
       "type": "object",
       "properties": {
        "kind": {
         "type": "string",
         "const": "insert-children"
        },
        "targetNodeId": {
         "type": "string",
         "minLength": 1,
         "maxLength": 200
        }
       },
       "required": [
        "kind",
        "targetNodeId"
       ],
       "additionalProperties": false
      },
      {
       "type": "object",
       "properties": {
        "kind": {
         "type": "string",
         "const": "replace"
        },
        "targetNodeId": {
         "type": "string",
         "minLength": 1,
         "maxLength": 200
        }
       },
       "required": [
        "kind",
        "targetNodeId"
       ],
       "additionalProperties": false
      }
     ]
    }
   },
   "required": [
    "source",
    "destination"
   ],
   "additionalProperties": false
  },
  {
   "type": "object",
   "properties": {
    "canvasId": {
     "type": "string",
     "format": "uuid",
     "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
    },
    "expectedVersion": {
     "type": "integer",
     "exclusiveMinimum": 0,
     "maximum": 9007199254740991
    }
   },
   "required": [
    "canvasId"
   ],
   "additionalProperties": false
  }
 ]
}

Example

Show example input
{
 "canvasId": "00000000-0000-4000-8000-000000000010",
 "source": {
  "kind": "html",
  "html": "<div></div>",
  "label": "Example"
 },
 "destination": {
  "kind": "insert-children",
  "targetNodeId": "root"
 }
}

Result

Returns a typed canvas.render.importSource result from the Enhance API without transport-specific prose.

Recovery

  • BAD_REQUEST: correct the named fields and call again.
  • UNAUTHORIZED: restore Enhance authentication, then retry once.
  • FORBIDDEN or NOT_FOUND: check the supplied resource and selection; do not substitute unrelated content. Ask for corrected access or scope if needed.
  • CONFLICT: read the current resource, merge the intended change, and retry with its version.
  • INTERNAL: run Enhance diagnostics, report the failure, and stop repeating the call.

Continue with

  • Read the affected canvas resource to confirm the result.

Compatibility: 0e3029d7679d2ff4df5b8b2934e84ed8a5ce72dbc2485fa1c30f4634a46f502c.