Get a calc rule
const url = 'https://example.com/api/v1/calc-rules/example';const options = {method: 'GET'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request GET \ --url https://example.com/api/v1/calc-rules/exampleReturns one calc rule by name (or uuid). Gated by rule:read.
Parameters
Section titled “ Parameters ”Path Parameters
Section titled “Path Parameters ”The rule’s name (its uuid is accepted too)
The rule’s name (its uuid is accepted too)
Responses
Section titled “ Responses ”OK
object
A URL to the JSON Schema for this object.
Why the stored reduce does not compile against the registries as they are now (an input key deleted or retyped, or an expression a newer diagnostic refuses); absent when it compiles. While present the rule cannot be enabled
object
The registered diagnostic that gave it, when one did (documented on the expressions page)
The 1-based column of the fault, when it has a line
The field at fault: an input’s key (inputs[0].key), reduce.expr or output_key
The 1-based line of the fault, when the reduce’s expression is what failed
Why it does not compile, or what it warns of
The warnings the stored reduce compiles with (a likely mistake, such as an input it never names), each with its code; notes only, never a fault: the rule computes all the same
object
The registered diagnostic that gave it, when one did (documented on the expressions page)
The 1-based column of the fault, when it has a line
The field at fault: an input’s key (inputs[0].key), reduce.expr or output_key
The 1-based line of the fault, when the reduce’s expression is what failed
Why it does not compile, or what it warns of
When the rule was created
What the rule derives and why
Whether the rule runs; an enabled rule is part of the key graph
The rule’s uuid, the stable form of name
The keys the rule reads, each by the alias its reduce uses
object
The name the reduce’s expression binds the input by
The key’s name now
The key’s uuid, which the rule holds it by
Which registry the key is in
A human label
The rule’s name, the address an operator types; renameable
Shipped with the platform and read-only
The property or metric the rule writes
Which lane the output key is on, derived from the registries
What the rule derives a value on: each component its selector picks, or each system its selector picks (read from the system’s role-bound members)
How many owners the caller may read hold a value the rule computed (on the list; 0 on a single read)
How many owners the caller may read the rule last failed on (on the list)
How many owners the caller may read are marked for the next tick (on the list)
How many owners the caller may read the rule last wrote nothing for: an input missing, a system with no members (on the list)
How the inputs reduce into the output: an expression over their aliases
object
An expression over the inputs by alias, each bound as the list of its current values (one per instance on a component, every member’s on a system), yielding the output key’s type: max(tcp), avg(temp), any(call) || max(people) > 0
The owners the rule derives for: a component rule’s components or a system rule’s systems; empty is every owner of its kind
object
A component rule: derive on components whose type falls within one of these component types
A component rule: derive on these components (by name or id on write; ids on read)
A system rule: derive on systems whose type falls within one of these system types (subtypes included)
A system rule: derive on these systems (by name or id on write; ids on read)
When the rule was last written
Bumps on every update
Example
{ "$schema": "/api/v1/schemas/CalcRuleBody.json", "inputs": [ { "lane": "property" } ], "output_lane": "property", "owner_kind": "component"}default
Section titled “default ”Error
object
A URL to the JSON Schema for this object.
A human-readable explanation specific to this occurrence of the problem.
Optional list of individual error details
object
Where the error occurred, e.g. ‘body.items[3].tags’ or ‘path.thing-id’
Error message text
The value at the given location
A URI reference that identifies the specific occurrence of the problem.
HTTP status code
A short, human-readable summary of the problem type. This value should not change between occurrences of the error.
A URI reference to human-readable documentation for the error.
Example
{ "$schema": "/api/v1/schemas/ErrorModel.json", "detail": "Property foo is required but is missing.", "instance": "https://example.com/error-log/abc123", "status": 400, "title": "Bad Request", "type": "about:blank"}