Ingest a batch of sensor events for the authenticated user
const url = 'http://localhost:11044/api/v1/sensor/events';const options = { method: 'POST', headers: {'X-Embabel-Api-Key': '<X-Embabel-Api-Key>', 'Content-Type': 'application/json'}, body: '{"events":[{"kind":"example","activities":["example"],"app":"example","confidence":1,"detail":"example","focusMode":"example","locked":true,"media":"example","stream":"example"}],"source":"example","timeZone":"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/sensor/events \ --header 'Content-Type: application/json' \ --header 'X-Embabel-Api-Key: <X-Embabel-Api-Key>' \ --data '{ "events": [ { "kind": "example", "activities": [ "example" ], "app": "example", "confidence": 1, "detail": "example", "focusMode": "example", "locked": true, "media": "example", "stream": "example" } ], "source": "example", "timeZone": "example" }'Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”A batch from one sensor, for the authenticated user: source (required, 400 when blank) names the sensor and namespaces its context streams; each event’s kind is fact (stored as a memory, {user} replaced by the user’s name, at most 2,000 characters, skipped as duplicate when an active memory has the same text ignoring case) or context (replaces that stream’s previous right-now signal, never stored). Events are accepted or rejected one by one; timeZone, an IANA zone, updates the user’s zone and is ignored when invalid
A batch of events the sensor app on the user’s machine pushes to POST /sensor/events
object
The events, each discriminated by its kind (fact or context). Each gets its own receipt
object
object
Which sensor is talking, e.g. me-app. Must not be blank; context streams are namespaced under it
IANA zone of the sensor’s machine, e.g. Australia/Sydney. A valid zone becomes the user’s time zone; an invalid one is ignored, and absent leaves the user’s zone as it is
Example generated
{ "events": [ { "kind": "example", "activities": [ "example" ], "app": "example", "confidence": 1, "detail": "example", "focusMode": "example", "locked": true, "media": "example", "stream": "example" } ], "source": "example", "timeZone": "example"}Responses
Section titled “Responses”Per-event receipts with accepted/deduplicated/rejected counts
What became of a sensor batch: counts by outcome, and a receipt per event
object
Facts skipped because the same text, ignoring case and surrounding whitespace, is already an active memory in the user’s current context
Context events recorded as what the user is doing now
One receipt per event, in the order the events were sent. A blank-source 400 carries a single receipt instead
The outcome for one event in a sensor batch
object
For stored, the new proposition’s id; for duplicate, the existing proposition it matched; for rejected, the reason; for observed, the activities and focus recorded, or null when there were none
A fact’s label as sent, or a context event’s stream. Null when the fact had no label, for a context event rejected for a blank stream, and on the one receipt of a blank-source rejection
stored (a new memory), duplicate (that text is already remembered), observed (a context signal recorded, never persisted) or rejected
Events refused. On a blank-source 400 this is every event in the batch
Facts stored as new memories
Example generated
{ "duplicates": 1, "observed": 1, "receipts": [ { "detail": "example", "label": "example", "status": "example" } ], "rejected": 1, "stored": 1}Blank source. The body is a batch response that rejects every event, with the reason on its one receipt
What became of a sensor batch: counts by outcome, and a receipt per event
object
Facts skipped because the same text, ignoring case and surrounding whitespace, is already an active memory in the user’s current context
Context events recorded as what the user is doing now
One receipt per event, in the order the events were sent. A blank-source 400 carries a single receipt instead
The outcome for one event in a sensor batch
object
For stored, the new proposition’s id; for duplicate, the existing proposition it matched; for rejected, the reason; for observed, the activities and focus recorded, or null when there were none
A fact’s label as sent, or a context event’s stream. Null when the fact had no label, for a context event rejected for a blank stream, and on the one receipt of a blank-source rejection
stored (a new memory), duplicate (that text is already remembered), observed (a context signal recorded, never persisted) or rejected
Events refused. On a blank-source 400 this is every event in the batch
Facts stored as new memories
Example generated
{ "duplicates": 1, "observed": 1, "receipts": [ { "detail": "example", "label": "example", "status": "example" } ], "rejected": 1, "stored": 1}
