edit_text

mutationSince v1.0

Replace one passage inside a long text, in place. You send the exact wording to remove and what should stand in its place; every other character stays as it was — so a long description or a published document can't quietly lose a paragraph to a rewrite. Prefer it over update_nodes for anything longer than a couple of sentences.

Read the current text first (get_node_details, or list_renderings / list_publications with the document included) so the passage you quote matches character for character. The passage must appear exactly once and match exactly; otherwise the edit is refused with an explanation rather than guessed at — usually a sign the text changed since you read it, so re-read it and try again. Set replace_all to change every occurrence; send an empty replacement to delete the passage.

It reaches the description of a node, relationship, asset or the model itself, the document of a rendering, and a publication's homepage. An asset's attached file is not text and cannot be patched this way.

With a locale, it patches that language's own wording — never the text it falls back to — and refuses if that language has nothing stored there yet, rather than filing default-language text in its place.

The response says what it did: how many replacements, which line, and how the length changed.

Parameters

NameTypeRequiredDefaultDescription
target_typeStringnodeWhat holds the text: node, relationship, model, rendering, publication or asset.
old_stringStringThe passage to replace, copied exactly as it is stored.
target_idStringWhich element — a UUID or an auto ID such as REQ-42. Renderings, publications and assets can also be named. Leave it out only when target_type is 'model'.
fieldStringWhich text to patch. Defaults to the description for a node, relationship, model or asset; the document for a rendering; the homepage for a publication.
new_stringStringWhat replaces it. An empty string deletes the passage.
replace_allBooleanfalseChange every occurrence instead of requiring the passage to appear only once.
localeStringPatch one language's own text, for example 'de'. Refused when that language has no text stored for this field yet.

Example Request

{"target_type": "node", "target_id": "REQ-42", "old_string": "reviewed quarterly by the data owner", "new_string": "reviewed monthly by the data owner"}

Example Response

{"success": true, "operation_count": 1, "versions": [102], "summary": "Patched description of 'Quarterly Review': 1 replacement(s) from line 4, 812 → 795 chars"}

This content was written collaboratively with AI.