Set, delete or import mapping rules
layerz_manage_mappingWrites the model's classification rules by op, in its single mapping set (created on first use). set: creates or updates rules identified by (source_id, pattern, secondary_pattern), one rule from the flat fields or up to 500 in rules (one form per call). pattern is a case-insensitive glob where * matches anywhere (Apport*, *641, 601000) tested against the source's primary key; secondary_pattern (default *) against its secondary key; source_id scopes the rule to one source (omitted = model-wide; a scoped rule wins on its source); target is an item name or uid, uid::entryUid for one entry of a list-mode item, or __ignore__ to route matching rows nowhere; sign (natural | negate | absolute) adjusts the amount. The batch is validated whole first (empty pattern, foreign source, target matching no item or several, repeated key): one failure writes nothing. Each rule reports created, updated or unchanged, with totals; a replay writes nothing. delete: removes mapping_id, or every id of mapping_ids (up to 500). import_template: duplicates the rules of the catalog template_id into the model set, targets translated by item name; a conflicting imported rule overwrites the model's, reported in overwritten. A rule change applies to the projected values on the next layerz_manage_integration { op: "sync" }. Rules live outside the model snapshot: no version is written, summary labels the call. Not advertised to read-only keys.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| op | Yes | Operation to run on the rules. | |
| sign | No | Sign convention applied to the matched amount (default natural). | |
| rules | No | `set`: up to 500 rules written as one batch, in place of the flat fields. | |
| target | No | Target item name or uid; `uid::entryUid` pins one list entry; `__ignore__` routes nowhere on purpose. | |
| pattern | No | Primary key glob (`*` anywhere) or exact value. | |
| summary | Yes | Short note (3–100 chars) describing the change, stored as the label of the resulting version. Examples: "Renamed Revenue to Net Revenue", "Imported 2024 OPEX from Excel". | |
| model_id | No | Target model UUID. Required for user-scoped API keys; validated against the bound model for model-scoped keys. | |
| source_id | No | Scopes the rule to one data source of the model (id from layerz_list_integrations). Omitted = model-wide. | |
| mapping_id | No | `delete`: rule id from layerz_list_mappings. | |
| mapping_ids | No | `delete`: up to 500 rule ids removed as one batch. | |
| template_id | No | `import_template`: catalog set id from layerz_list_mappings `templates`. | |
| secondary_pattern | No | Secondary key glob tested against the source's `dimension_by` field (default `*` = any). |