System Events
3 API calls in this section.
List Events
/system/events?tenant_id={{tenant_id}}&event_type=&source_module=&target_module=&status=&entity_type=&page=1&limit=100Retrieves a paginated list of system events with optional filtering by event type, source module, target module, status, and entity type. Authentication: - Requires valid authentication token - User must have 'manage:system' permission or be a system admin Query Parameters: - tenant_id (optional for system admins): UUID of the tenant - event_type (optional): Filter by event type - source_module (optional): Filter by source module - target_module (optional): Filter by target module - status (optional): Filter by event status (pending, processed, failed) - entity_type (optional): Filter by entity type - page (optional): Page number for pagination (default: 1) - limit (optional): Number of items per page (default: 100) Response: - Returns a paginated list of system events - Includes pagination metadata (total count, page, limit)
1curl --request GET "$ONDI_BASE_URL/system/events?tenant_id={{tenant_id}}&event_type=&source_module=&target_module=&status=&entity_type=&page=1&limit=100" \2 --header "Authorization: Bearer {{access_token}}" \3 --header "Content-Type: application/json"Query parameters
tenant_idOptional{{tenant_id}}
UUID of the tenant (optional for system admins)
event_typeOptionalFilter by event type (optional)
source_moduleOptionalFilter by source module (optional)
target_moduleOptionalFilter by target module (optional)
statusOptionalFilter by event status (optional, e.g., 'pending', 'processed', 'failed')
entity_typeOptionalFilter by entity type (optional)
pageOptional1
Page number for pagination (optional, default: 1)
limitOptional100
Number of items per page (optional, default: 100)
Headers
AuthorizationOptionalBearer {{access_token}}
Content-TypeOptionalapplication/json
Responses
1{2 "success": true,3 "message": "Events retrieved successfully",4 "events": [5 {6 "id": "event-uuid-1",7 "tenant_id": "tenant-uuid",8 "event_type": "inventory_updated",9 "source_module": "inventory",10 "target_module": "warehouse",11 "entity_type": "inventory_item",12 "entity_id": "item-uuid-1",13 "event_data": {14 "previous_quantity": 100,15 "new_quantity": 95,16 "warehouse_id": "warehouse-uuid-1"17 },18 "status": "processed",19 "retry_count": 0,20 "created_at": "2023-04-01T10:00:00Z",21 "processed_at": "2023-04-01T10:01:00Z",22 "error_message": null23 },24 {25 "id": "event-uuid-2",26 "tenant_id": "tenant-uuid",27 "event_type": "delivery_assigned",28 "source_module": "logistics",29 "target_module": "notifications",30 "entity_type": "delivery",31 "entity_id": "delivery-uuid-1",32 "event_data": {33 "driver_id": "driver-uuid-1",34 "delivery_date": "2023-04-05T09:00:00Z"35 },36 "status": "pending",37 "retry_count": 0,38 "created_at": "2023-04-01T11:30:00Z",39 "processed_at": null,40 "error_message": null41 }42 ],43 "page": 1,44 "limit": 100,45 "total": 246}1{2 "success": false,3 "message": "Insufficient permissions"4}1{2 "success": false,3 "message": "Internal server error"4}Publish Event
/system/events?tenant_id={{tenant_id}}Creates a new system event for inter-module communication. Events are used to notify other modules about changes or actions that occurred in the system. Authentication: - Requires valid authentication token - Must have system-generated token OR 'manage:system' permission or be a system admin Query Parameters: - tenant_id (optional if in auth context): UUID of the tenant Business Rules: - event_data must be a valid JSON object - All required fields must be provided - Event is created with status 'pending' and retry_count of 0
1curl --request POST "$ONDI_BASE_URL/system/events?tenant_id={{tenant_id}}" \2 --header "Authorization: Bearer {{access_token}}" \3 --header "Content-Type: application/json" \4 --header "Content-Type: application/json" \5 --data '{6 "event_type": "inventory_updated",7 "source_module": "inventory",8 "target_module": "warehouse",9 "entity_type": "inventory_item",10 "entity_id": "{{item_id}}",11 "event_data": {12 "previous_quantity": 100,13 "new_quantity": 95,14 "warehouse_id": "{{warehouse_id}}"15 }16}'1{2 "event_type": "inventory_updated",3 "source_module": "inventory",4 "target_module": "warehouse",5 "entity_type": "inventory_item",6 "entity_id": "{{item_id}}",7 "event_data": {8 "previous_quantity": 100,9 "new_quantity": 95,10 "warehouse_id": "{{warehouse_id}}"11 }12}Query parameters
tenant_idOptional{{tenant_id}}
UUID of the tenant (optional if in auth context)
Request body fields
event_typeExampleExample field from the request body.
source_moduleExampleExample field from the request body.
target_moduleExampleExample field from the request body.
entity_typeExampleExample field from the request body.
entity_idExampleExample field from the request body.
event_dataExampleExample field from the request body.
event_data.previous_quantityExampleExample field from the request body.
event_data.new_quantityExampleExample field from the request body.
event_data.warehouse_idExampleExample field from the request body.
Headers
AuthorizationOptionalBearer {{access_token}}
Content-TypeOptionalapplication/json
Responses
1{2 "success": true,3 "message": "Event published successfully",4 "event": {5 "id": "event-uuid-new",6 "tenant_id": "tenant-uuid",7 "event_type": "inventory_updated",8 "source_module": "inventory",9 "target_module": "warehouse",10 "entity_type": "inventory_item",11 "entity_id": "item-uuid-1",12 "event_data": {13 "previous_quantity": 100,14 "new_quantity": 95,15 "warehouse_id": "warehouse-uuid-1"16 },17 "status": "pending",18 "retry_count": 0,19 "created_at": "2023-04-01T15:00:00Z",20 "processed_at": null,21 "error_message": null22 }23}1{2 "success": false,3 "message": "Field required entity_id"4}1{2 "success": false,3 "message": "Event data must be object"4}1{2 "success": false,3 "message": "Insufficient permissions"4}Update Event Status
/system/events/:id?tenant_id={{tenant_id}}Updates the status of an existing system event. This endpoint is typically used by event processors to mark events as processed or failed. Authentication: - Requires valid authentication token - Must have system-generated token OR 'manage:system' permission or be a system admin Path Parameters: - id (required): UUID of the event to update Query Parameters: - tenant_id (optional if in auth context): UUID of the tenant Business Rules: - Status must be one of: pending, processed, failed - If status is changed to 'processed' and processed_at is not provided, current timestamp will be used - If status is changed to 'failed', retry_count will be incremented - Event must exist in the system
1curl --request PUT "$ONDI_BASE_URL/system/events/:id?tenant_id={{tenant_id}}" \2 --header "Authorization: Bearer {{access_token}}" \3 --header "Content-Type: application/json" \4 --header "Content-Type: application/json" \5 --data '{6 "status": "processed",7 "processed_at": "2023-04-01T15:05:00Z",8 "error_message": null9}'1{2 "status": "processed",3 "processed_at": "2023-04-01T15:05:00Z",4 "error_message": null5}Path parameters
idRequired{{event_id}}
UUID of the event to update (required)
Query parameters
tenant_idOptional{{tenant_id}}
UUID of the tenant (optional if in auth context)
Request body fields
statusExampleExample field from the request body.
processed_atExampleExample field from the request body.
error_messageExampleExample field from the request body.
Headers
AuthorizationOptionalBearer {{access_token}}
Content-TypeOptionalapplication/json
Responses
1{2 "success": true,3 "message": "Event updated successfully",4 "event": {5 "id": "event-uuid-2",6 "tenant_id": "tenant-uuid",7 "event_type": "delivery_assigned",8 "source_module": "logistics",9 "target_module": "notifications",10 "entity_type": "delivery",11 "entity_id": "delivery-uuid-1",12 "event_data": {13 "driver_id": "driver-uuid-1",14 "delivery_date": "2023-04-05T09:00:00Z"15 },16 "status": "processed",17 "retry_count": 0,18 "created_at": "2023-04-01T11:30:00Z",19 "processed_at": "2023-04-01T15:05:00Z",20 "error_message": null21 }22}1{2 "success": true,3 "message": "Event updated successfully",4 "event": {5 "id": "event-uuid-2",6 "tenant_id": "tenant-uuid",7 "event_type": "delivery_assigned",8 "source_module": "logistics",9 "target_module": "notifications",10 "entity_type": "delivery",11 "entity_id": "delivery-uuid-1",12 "event_data": {13 "driver_id": "driver-uuid-1",14 "delivery_date": "2023-04-05T09:00:00Z"15 },16 "status": "failed",17 "retry_count": 1,18 "created_at": "2023-04-01T11:30:00Z",19 "processed_at": null,20 "error_message": "Target module unavailable"21 }22}1{2 "success": false,3 "message": "Field required status"4}1{2 "success": false,3 "message": "Invalid status"4}