Skip to Content
Heuristic documentation

apply_hierarchy_changes

Changes data

Edit a product's hierarchy: the only way to add, rename, describe, move, merge or delete its categories and features. Send an ordered list of steps, each an object with op and that kind's fields; a single edit is a list of one step:

  • create_category: title, optional description, parentId (a category holding no features, or null for the top level) and optional id.
  • create_feature: a feature with no documentation page: title, optional description, categoryId (a category holding no subcategories) and optional id.
  • update_category: categoryId and either new text (title, description; empty clears it) or a new place (parentId), not both. Moving into a category that holds features moves those features, in order, into a new subcategory "Other" after it, whose id otherId optionally sets.
  • update_feature: featureId and either new text (title, description) or a new place (categoryId, holding no subcategories), not both. A moved feature keeps its name.
  • merge_category: categoryId into intoId, which keeps its title and gets its subcategories and features at its end. Not into itself, a category above or below it, nor when subcategories and features would mix.
  • merge_feature: featureId into intoId, which keeps its title, description and source; the feature's feedback moves to intoId.
  • delete_category: categoryId, with its subcategories and every feature below it; their feedback moves to New opportunity.
  • delete_feature: featureId; a later knowledge base read doesn't add it back, and its feedback moves to New opportunity. Each step runs on the tree as the earlier steps left it, under its rules: a category holds either subcategories or features, never both, and never goes under itself; sibling order can't be set. A step that would change nothing is skipped, not refused: the same text, a move to where the item already is, an add already made with the same values. To restructure, create the new categories, move into them, then merge or delete what is left. Work in two calls. Find ids with search or a compact get_hierarchy, then send the steps with dryRun: true and that read's version as expectedVersion: nothing is saved, and the answer lists each step's changes (edited fields with their value before), skipped steps, problems (each step that would be refused, with the rule and the ids of allowed places), how many linked insights each delete or feature merge would move (moving: to New opportunity, or to the feature merged into; a category merge moves none) and the resulting tree around the named items. Show the person the outcome, and ask before deletes and merges. Then send the same steps without dryRun: all are saved or none. The first refused step stops the call and saves nothing: its refusal is the answer, the message starting "Step <n>: " and details.step naming it. A save answers the hierarchy change it stored and the new version; when every step was skipped nothing is stored and change is null. One undo_change with area hierarchy reverses it all; undoing that undo does it all again. At most 50 steps and 64 KB per call. expectedVersion refuses the call (conflict) when the hierarchy changed since your read: read again, check the plan, send the new version. A retry is safe: the same save again answers the first result while it is the product's newest change, yours and not undone. Product Owners and Admins only; Viewers are refused, also for a preview.

Inputs

Who can use it
Admins and the product's Owners
Hints
Changes dataCan remove dataSafe to repeat
Runs
apply_hierarchy_changes
Inputs
  • productId string, required

    From read_product with action list or get_me.

  • body object, required

    An ordered list of hierarchy changes, previewed with dryRun or saved as one change.

    • steps array of objects, required

      The changes to make, in order, 1 to 50. Each is one object: op names the kind of change and the other fields are its inputs. Later steps may name ids earlier steps chose.

      One of:
      • op: create_category

        • id string

          Optional: a new uuid you choose for what this step adds, so later steps can name it and a retry is safe: a repeat with the same id and values is skipped.

        • title string, required

          The category's title, 1 to 100 characters on one line.

        • description string or null

          What the category covers; empty or null for none.

        • parentId string or null, required

          The parent category, from search or get_hierarchy (or an earlier step's id); null for the top level.

      • op: create_feature

        • id string

          Optional: a new uuid you choose for what this step adds, so later steps can name it and a retry is safe: a repeat with the same id and values is skipped.

        • title string, required

          The feature's title, 1 to 80 characters on one line.

        • description string or null

          What the feature does, starting with a verb; empty or null for none.

        • categoryId string, required

          From search or get_hierarchy, or an id an earlier step chose.

      • op: update_category

        • title string

          The category's title, 1 to 100 characters on one line.

        • description string or null

          What the category covers; empty or null for none.

        • parentId string or null

          The parent category, from search or get_hierarchy (or an earlier step's id); null for the top level.

        • otherId string

          Optional: a new uuid you choose for the subcategory Other that a move into a category holding features makes; refused when another item has it. A repeated move is skipped.

        • categoryId string, required

          From search or get_hierarchy, or an id an earlier step chose.

      • op: update_feature

        • title string

          The feature's title, 1 to 80 characters on one line.

        • description string or null

          What the feature does, starting with a verb; empty or null for none.

        • categoryId string

          From search or get_hierarchy, or an id an earlier step chose.

        • featureId string, required

          From search or get_hierarchy, or an id an earlier step chose.

      • op: merge_category

        • categoryId string, required

          From search or get_hierarchy, or an id an earlier step chose.

        • intoId string, required

          The id of the item to merge into, from search or get_hierarchy, or an id an earlier step chose.

      • op: merge_feature

        • featureId string, required

          From search or get_hierarchy, or an id an earlier step chose.

        • intoId string, required

          The id of the item to merge into, from search or get_hierarchy, or an id an earlier step chose.

      • op: delete_category

        • categoryId string, required

          From search or get_hierarchy, or an id an earlier step chose.

      • op: delete_feature

        • featureId string, required

          From search or get_hierarchy, or an id an earlier step chose.

    • dryRun boolean

      true: save nothing and answer the outcome (changes, skipped and refused steps, the resulting tree).

    • expectedVersion string

      The version from get_hierarchy (or a dry run) you planned from; refused when the hierarchy changed since.