Create a watch
const url = 'http://localhost:11044/api/v1/watches';const options = { method: 'POST', headers: {'X-Embabel-Api-Key': '<X-Embabel-Api-Key>', 'Content-Type': 'application/json'}, body: '{"cron":"example","delivery":{"channel":"example","format":"example","headers":{"additionalProperty":"example"},"secret":"example","tier":"example","url":"example"},"diffSpec":{"compareFields":["example"],"ignoreFields":["example"],"keyPath":"example","keyedListFields":{"additionalProperty":"example"},"resultMode":"AUTO","setFields":["example"],"transitions":[{"crossesAbove":1,"crossesBelow":1,"field":"example","from":{},"name":"example","to":{}}]},"enabled":true,"firstRunPolicy":"ESTABLISH_BASELINE","lensId":"example","name":"example","params":{"additionalProperty":"example"}}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url http://localhost:11044/api/v1/watches \ --header 'Content-Type: application/json' \ --header 'X-Embabel-Api-Key: <X-Embabel-Api-Key>' \ --data '{ "cron": "example", "delivery": { "channel": "example", "format": "example", "headers": { "additionalProperty": "example" }, "secret": "example", "tier": "example", "url": "example" }, "diffSpec": { "compareFields": [ "example" ], "ignoreFields": [ "example" ], "keyPath": "example", "keyedListFields": { "additionalProperty": "example" }, "resultMode": "AUTO", "setFields": [ "example" ], "transitions": [ { "crossesAbove": 1, "crossesBelow": 1, "field": "example", "from": {}, "name": "example", "to": {} } ] }, "enabled": true, "firstRunPolicy": "ESTABLISH_BASELINE", "lensId": "example", "name": "example", "params": { "additionalProperty": "example" } }'Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”The watch to create over one of the caller’s saved lenses. lensId must name a lens the caller can open (400 otherwise); name defaults to the lens id; params are the lens arguments every run uses. cron is a Spring six-field cron expression (seconds first) that schedules runs, and omitted or blank means runs happen only on request; an unparseable one is 400. diffSpec chooses what counts as a change, delivery where changes are sent (omitted: kept in history only), firstRunPolicy whether the first run only records a baseline (ESTABLISH_BASELINE, the default) or reports everything as new (EMIT_CURRENT), and enabled (default true) whether it runs at all
The body of POST /watches: which saved lens to watch with what arguments, when to run it, and how to compare and deliver what changes.
object
Spring cron expression, six fields with seconds first (such as 0 0 8 * * *), evaluated in the server’s time zone. Omitted or blank, the watch runs only when POST /watches/{watchId}/runs asks
Where each diff is sent: channel notification (the inbox), signal (the agent bus) or webhook. Omitted or null, diffs are kept in the watch’s history only
object
The adapter: notification (the inbox, the default), signal (the bus, for agents) or webhook (a URL). A lowercase adapter id
A webhook’s body: json (the whole diff, the default) or slack (a text summary an incoming webhook shows as-is)
Extra headers sent on every webhook delivery, e.g. an Authorization. At most 16; X-World-* and Content-Type cannot be set. Values are write-only: a read masks each, and an update that sends a mask back keeps that value
object
When set, a webhook body is signed with HMAC-SHA256 under it, sent as X-World-Signature: sha256=<hex>. Write-only: a read returns ••••••••, and an update that sends that back keeps the stored secret
The inbox tier a notification delivery is filed at: AMBIENT (the default), DEFERRED, TIMELY, INTERRUPTIVE, ACTING or ESCALATING, case-insensitive; anything else files as AMBIENT. Read by no other channel
The http(s) URL a webhook delivery is POSTed to. Required for webhook; unused otherwise
How a run’s result is compared with the previous complete run’s; omitted takes every DiffSpec default
object
The fields compared. Empty compares a structured item whole; an entity always compares source, id, name, description and labels, and these are added to them
Fields removed before comparing, so a change to one is never a change. May not overlap compareFields
The path to each item’s key in a structured result. Required when the result is an array; for a single object it is optional. Unused for entities, which are keyed by source and id
Array fields of objects, each mapped to the path of the key within an element: elements are ordered by that key before comparing, so a reordering is not a change
object
ENTITIES compares the lens’s graph entities, STRUCTURED its structured data, and AUTO (the default) picks STRUCTURED only when the lens returned no entities but did return data
Array fields compared as unordered sets, so a reordering is not a change
Named transitions to recognise among an updated item’s field changes
A named domain transition: matched when one field of an updated item changes in the stated way. Every condition given must hold, and at least one must be given
object
Matches a numeric field going from at or below this value to above it
Matches a numeric field going from at or above this value to below it
The dotted path of the field watched. Must be in compareFields, or one of an entity’s own source, id, name, description or labels
The JSON value the field must have changed from. Absent matches any
object
What to call the transition; reported as the kind of each one detected
The JSON value the field must have changed to. Absent matches any
object
False creates the watch switched off, so it is not scheduled and runs are refused; true when omitted
ESTABLISH_BASELINE (the default): the first run records what the lens shows and produces no diff. EMIT_CURRENT: the first run is diffed against nothing, so everything it finds is reported
Id of the saved lens to watch; it must be one the signed-in user can open
Label for the watch; the lensId when omitted or blank
Arguments given to the lens on every run, by parameter name; empty runs it on its defaults
object
Responses
Section titled “Responses”OK
object
Example generated
{}
