Skip to content

Tests a rule configuration in dry-run mode without saving. Useful for previewing what a new rule would detect before creating it

POST
/api/automation/rules/test-preview

Auto-generated from server.go. Handler: s.automationHandlers.TestRulePreview.

object
key
additional properties
any

Dry-run preview

Response from POST /api/automation/rules/test-preview. Returns a dry-run preview of MACs that would match the proposed rule. Mirrors the gin.H literal in internal/api/handlers_automation.go::TestRulePreview and the TestRuleResult struct in internal/automation/types.go (hand-lifted Phase 70-03 Session 6 — sampler’s generic body produces an internal scheduler error against the seeded MV state).

Note: the inner DetectedMAC struct has no JSON tags, so Go emits capitalised field names verbatim on the wire.

object
status
required

Always success on the 200 path.

string
data
required

TestRuleResult — detected MACs and aggregate counts.

object
detected_macs
required
Array<object>
object
ClientMAC
required
string
ClientDUID
required

DHCPv6 DUID for clients without an extractable MAC.

string
VendorClass
required
string
RequestCount
required

Sum of requests over the lookback window (ClickHouse UInt64).

integer format: int64
UniqueIPs
required

Count of unique IPs over the lookback window (ClickHouse UInt64).

integer format: int64
FirstSeen
required
string format: date-time
LastSeen
required
string format: date-time
Protocol
required

Either dhcpv4 or dhcpv6.

string
total_count
required

Total number of detected MAC rows.

integer
query_executed
required

The SQL query the scheduler executed.

string
execution_time_ms
required

ClickHouse-reported execution time in milliseconds.

number format: float

The request body or parameters failed validation.

Standardised error envelope per RFC 7807. Many existing endpoints still return an older shape (e.g. {"error": "..."}). This schema documents the target shape; legacy endpoints will be migrated in Phase 70. Per D-21 the spec describes current behaviour without enforcing the migration here.

object
type

A URI reference that identifies the problem type.

string format: uri-reference
default: about:blank
title

A short human-readable summary of the problem.

string
status

The HTTP status code generated by the origin server.

integer format: int32
>= 100 <= 599
detail

A human-readable explanation specific to this occurrence.

string
instance

A URI reference that identifies the specific occurrence.

string format: uri-reference
error

Legacy error message field. Will be removed once handlers are migrated.

string
details

Legacy per-field error details. Will be removed once handlers are migrated.

object
key
additional properties
string
requestId

The request id middleware-assigned identifier for tracing.

string

Authentication is required or the supplied token is invalid.

Standardised error envelope per RFC 7807. Many existing endpoints still return an older shape (e.g. {"error": "..."}). This schema documents the target shape; legacy endpoints will be migrated in Phase 70. Per D-21 the spec describes current behaviour without enforcing the migration here.

object
type

A URI reference that identifies the problem type.

string format: uri-reference
default: about:blank
title

A short human-readable summary of the problem.

string
status

The HTTP status code generated by the origin server.

integer format: int32
>= 100 <= 599
detail

A human-readable explanation specific to this occurrence.

string
instance

A URI reference that identifies the specific occurrence.

string format: uri-reference
error

Legacy error message field. Will be removed once handlers are migrated.

string
details

Legacy per-field error details. Will be removed once handlers are migrated.

object
key
additional properties
string
requestId

The request id middleware-assigned identifier for tracing.

string

Internal server error

Standardised error envelope per RFC 7807. Many existing endpoints still return an older shape (e.g. {"error": "..."}). This schema documents the target shape; legacy endpoints will be migrated in Phase 70. Per D-21 the spec describes current behaviour without enforcing the migration here.

object
type

A URI reference that identifies the problem type.

string format: uri-reference
default: about:blank
title

A short human-readable summary of the problem.

string
status

The HTTP status code generated by the origin server.

integer format: int32
>= 100 <= 599
detail

A human-readable explanation specific to this occurrence.

string
instance

A URI reference that identifies the specific occurrence.

string format: uri-reference
error

Legacy error message field. Will be removed once handlers are migrated.

string
details

Legacy per-field error details. Will be removed once handlers are migrated.

object
key
additional properties
string
requestId

The request id middleware-assigned identifier for tracing.

string