Skip to main content

System Events

3 API calls in this section.

List Events​

System Configuration / System Events
GET/system/events

Retrieves a paginated list of system events with optional filtering by event type, source module, target module, status, and entity type.

  • User must have 'manage:system' permission or be a system admin

Response

  • Returns a paginated list of system events

  • Includes pagination metadata (total count, page, limit)

Query parameters

ParameterTypeDescription
tenant_idOptionalstring

UUID of the tenant (optional for system admins) (optional for system admins): UUID of the tenant

Example: {{tenant_id}}

event_typeOptionalstring

Filter by event type (optional)

source_moduleOptionalstring

Filter by source module (optional)

target_moduleOptionalstring

Filter by target module (optional)

statusOptionalstring

Filter by event status (optional, e.g., 'pending', 'processed', 'failed') Filter by event status (pending, processed, failed)

entity_typeOptionalstring

Filter by entity type (optional)

pageOptionalstring

Page number for pagination (optional, default: 1) Page number for pagination (default: 1)

Example: 1

limitOptionalstring

Number of items per page (optional, default: 100) Number of items per page (default: 100)

Example: 100

Headers

ParameterTypeDescription
Authorizationstring

Example: Bearer {{access_token}}

Content-Typestring

Example: application/json

Staging
Request
curl
1curl --globoff --request GET "https://staging-api.ondi.io/functions/v1/system/events?tenant_id=${TENANT_ID}&event_type=&source_module=&target_module=&status=&entity_type=&page=1&limit=100" \2  --header "Authorization: Bearer ${ONDI_ACCESS_TOKEN}" \3  --header "Content-Type: application/json"

Response examples

200OK
Response body
json
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}

Publish Event​

System Configuration / System Events
POST/system/events

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.

  • Must have system-generated token OR 'manage:system' permission or be a system admin

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

Query parameters

ParameterTypeDescription
tenant_idOptionalstring

UUID of the tenant (optional if in auth context) (optional if in auth context): UUID of the tenant

Example: {{tenant_id}}

Headers

ParameterTypeDescription
Authorizationstring

Example: Bearer {{access_token}}

Content-Typestring

Example: application/json

Body parameters

ParameterTypeDescription
event_typestring—
source_modulestring—
target_modulestring—
entity_typestring—
entity_idstring—
event_dataobject—
event_data.previous_quantitynumber—
event_data.new_quantitynumber—
event_data.warehouse_idstring—
Staging
Request
curl
1curl --globoff --request POST "https://staging-api.ondi.io/functions/v1/system/events?tenant_id=${TENANT_ID}" \2  --header "Authorization: Bearer ${ONDI_ACCESS_TOKEN}" \3  --header "Content-Type: application/json" \4  --data-raw '{5  "event_type": "inventory_updated",6  "source_module": "inventory",7  "target_module": "warehouse",8  "entity_type": "inventory_item",9  "entity_id": "{{item_id}}",10  "event_data": {11    "previous_quantity": 100,12    "new_quantity": 95,13    "warehouse_id": "{{warehouse_id}}"14  }15}'

Replace {{placeholders}} with your own values before sending.

Other request examples (1)
Request example 1
text
1{2  "event_type": "string", // required - Type of event (e.g., inventory_updated, delivery_assigned)3  "source_module": "string", // required - Module that published the event4  "target_module": "string", // optional - Target module for the event5  "entity_type": "string", // required - Type of entity related to the event6  "entity_id": "uuid", // required - ID of the related entity7  "event_data": {} // required - JSON object containing event payload data8}

Response examples

201Created
Response body
json
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}

Update Event Status​

System Configuration / System Events
PUT/system/events/:id

Updates the status of an existing system event. This endpoint is typically used by event processors to mark events as processed or failed.

  • Must have system-generated token OR 'manage:system' permission or be a system admin

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

Path parameters

ParameterTypeDescription
idRequiredstring

UUID of the event to update (required)

Example: {{event_id}}

Query parameters

ParameterTypeDescription
tenant_idOptionalstring

UUID of the tenant (optional if in auth context) (optional if in auth context): UUID of the tenant

Example: {{tenant_id}}

Headers

ParameterTypeDescription
Authorizationstring

Example: Bearer {{access_token}}

Content-Typestring

Example: application/json

Body parameters

ParameterTypeDescription
statusstring—
processed_atstring—
error_messagenull—
Staging
Request
curl
1curl --globoff --request PUT "https://staging-api.ondi.io/functions/v1/system/events/${ID}?tenant_id=${TENANT_ID}" \2  --header "Authorization: Bearer ${ONDI_ACCESS_TOKEN}" \3  --header "Content-Type: application/json" \4  --data-raw '{5  "status": "processed",6  "processed_at": "2023-04-01T15:05:00Z",7  "error_message": null8}'
Other request examples (1)
Request example 1
text
1{2  "status": "string", // required - New status (pending, processed, failed)3  "processed_at": "string", // optional - ISO timestamp when the event was processed4  "error_message": "string" // optional - Error message if the event processing failed5}

Response examples

200OK
Response body
json
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}