File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -436,6 +436,7 @@ async def get_events(request: Request):
436436 - state: Event state to filter events
437437 - result: Event result to filter events
438438 - id / ids: Event document id(s) to filter events
439+ - node_id: Node id to filter events (alias for data.id)
439440 - recursive: Retrieve node together with event
440441 This API endpoint is under development and may change in future.
441442 """
@@ -447,6 +448,14 @@ async def get_events(request: Request):
447448 state = query_params .pop ('state' , None )
448449 result = query_params .pop ('result' , None )
449450 from_ts = query_params .pop ('from' , None )
451+ node_id = query_params .pop ('node_id' , None )
452+ if node_id :
453+ if 'data.id' in query_params :
454+ raise HTTPException (
455+ status_code = status .HTTP_400_BAD_REQUEST ,
456+ detail = "Provide either node_id or data.id, not both"
457+ )
458+ query_params ['data.id' ] = node_id
450459 # Support filtering by MongoDB _id.
451460 # Accept `id=<hex>` for a single id or `ids=a,b,c` for multiple ids.
452461 # Using `id` as query param is safe here because we remove it from the
Original file line number Diff line number Diff line change @@ -112,8 +112,12 @@ Supported query parameters for `/events`:
112112| ` result ` | string | Filter by ` data.result ` . |
113113| ` limit ` | integer | Maximum number of events to return. |
114114| ` recursive ` | bool | Attach related node info to each event (max ` limit ` 1000). |
115- | ` id ` | string (Mongo ObjectId) | Filter by a single event document id. |
115+ | ` id ` | string (Mongo ObjectId) | Filter by a single event document id (top‑level ` id ` in ` /events ` response) . |
116116| ` ids ` | string (comma‑separated ObjectIds) | Filter by multiple event document ids. |
117+ | ` node_id ` | string | Filter events by affected node id (alias for ` data.id ` ). |
118+
119+ Note: ` id ` /` ids ` refer to the event history document id, not the node id. To get
120+ events about a node, use ` node_id ` (or ` data.id ` ).
117121
118122## Subscriber ID Guidelines
119123
You can’t perform that action at this time.
0 commit comments