Add sections
insert_nodesAdd many nodes to a site in ONE call, batched into one new draft version. Each insertion is {parent_id, position, node}: parent_id locates an existing parent anywhere in the fixture (pages + siteElements), position is 'start' | 'end' | {after_id}, and node is the subtree to splice in. Use this for structural addition — adding a new section to a page, inserting a nav link, adding a card to a grid, restoring a container that was accidentally removed. To add one more of something that already exists (a menu item, card, team member, timetable column, link), send copy_of: instead of node — the copy matches exactly; then patch_nodes its text using the returned id_map. To show a collection's entries on ANOTHER page ('put my three latest projects on the About page'), copy_of the collection-list — or the grid holding it — from a page that already shows them, then set the copy's limit: a list stays in step with the collection, while hand-copied cards go stale the moment an entry changes. Safe alternative to patch_fixture's JSON-Patch 'add' ops: no hand-constructed paths, validated parent + unique-id checks, and the subtree goes through the same primitive schema as any other node. Use get_primitive_schema + get_primitive_schema to shape the new node's data. Tag each content node with its semantic role — "extra": { "slot": "hero-title" } — so the next read of get_page (with view: "content") can say what the node IS rather than reporting a null role; an unknown slot name is rejected with the closest valid ones, and untagged content comes back as a warning. If a parent or after_id is missing, or a new id collides, the whole batch is rejected. Up to 50 insertions per call. A node may also be sent as a JSON string (node as a string, or a single top-level parent_id + node_json).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| site_id | Yes | ||
| insertions | Yes | Array of insertions, each placing a new node under a parent. All applied as ONE new draft version. Position defaults to 'end' when omitted. If any parent_id is missing, or any new node id collides with an existing id, or the after_id doesn't match an existing child of parent_id, the whole batch is rejected. Up to 50 insertions per call. |