Comprehensive guides and references for the OpenFrame platform
The External Api Service Core Rest And Dto module exposes a public, API-key–secured REST interface for interacting with the OpenFrame platform. It is designed for external integrations, automation systems, and third-party tools that require programmatic access to devices, events, logs, organizations, and integrated tools.
This module acts as a thin, well-documented REST façade over internal domain services, enforcing API key authentication, pagination, filtering, sorting, and structured DTO-based responses.
The External Api Service Core Rest And Dto module is responsible for:
/api/v1/**X-API-Key) authenticationIt does not implement core business logic itself. Instead, it delegates to domain services from the API, data, and integration layers.
flowchart LR
Client["External Client"] -->|"X-API-Key"| Controller["REST Controllers"]
Controller --> Service["Domain Services"]
Service --> Repository["Data Repositories"]
Service --> Mapper["External Mappers"]
Mapper --> DTO["External DTO Responses"]
Controller --> Proxy["RestProxyService"]
Proxy --> IntegratedTool["Integrated Tool API"]
OpenApiConfigThe OpenApiConfig class configures Swagger/OpenAPI documentation for the external API.
ApiKeyAuthX-API-Key/tools/**, /test/**, /api/v1/**/actuator/**, /api/core/**X-API-Key: ak_keyId.sk_secretKey
All endpoints require a valid API key.
Each controller exposes a specific functional domain.
Base Path: /api/v1/devices
Responsibilities:
Key features:
DeviceService, DeviceFilterService, TagServiceBase Path: /api/v1/events
Responsibilities:
Filtering options include:
Base Path: /api/v1/logs
Responsibilities:
Supports filtering by:
Log details retrieval uses a composite key:
ingestDaytoolTypeeventTypetimestamptoolEventIdBase Path: /api/v1/organizations
Responsibilities:
organizationIdDeletion safeguards:
Base Path: /api/v1/tools
Responsibilities:
Delegates to ToolService and uses ToolMapper to convert domain entities into ToolResponse DTOs.
Base Path: /tools/{toolId}/**
This controller proxies arbitrary HTTP requests to integrated third-party tools via RestProxyService.
flowchart TD
Client["External Client"] --> Controller["IntegrationController"]
Controller --> ProxyService["RestProxyService"]
ProxyService --> Repo["IntegratedToolRepository"]
ProxyService --> UrlResolver["ProxyUrlResolver"]
ProxyService --> Target["External Tool API"]
Capabilities:
The DTO layer defines stable contracts for external clients.
PaginationCriteriaSortCriteriaPageInfoPagination:
DeviceResponseDevicesResponseDeviceFilterCriteriaDeviceFilterResponseEncapsulates:
EventResponseEventsResponseEventFilterCriteriaEventFilterResponseEncapsulates:
LogResponseLogsResponseLogDetailsResponseLogFilterCriteriaLogFilterResponseDesigned for audit and security event retrieval with detailed metadata.
OrganizationsResponseSupports:
ToolResponseToolsResponseToolFilterCriteriaToolFilterResponseToolUrlResponseIncludes:
Example: Device query request
flowchart TD
A["HTTP GET /api/v1/devices"] --> B["DeviceController"]
B --> C["Build FilterCriteria"]
C --> D["DeviceService.queryDevices()"]
D --> E["Domain Query"]
E --> F["DeviceMapper"]
F --> G["DevicesResponse"]
G --> H["HTTP 200 JSON Response"]
Common patterns across controllers:
Standard HTTP status codes are used:
200 – Success201 – Created204 – No Content400 – Bad Request401 – Unauthorized (invalid API key)403 – Forbidden404 – Resource not found409 – Conflict429 – Too Many Requests500 – Internal Server ErrorControllers throw domain-specific exceptions such as:
DeviceNotFoundExceptionEventNotFoundExceptionLogNotFoundExceptionOrganizationNotFoundExceptionThese are translated into structured error responses.
The External Api Service Core Rest And Dto module relies on:
X-API-KeyX-User-IdX-API-Key-IdRate limiting is applied per API key (configured outside this module).
flowchart LR
ExternalClient["External Integration"] --> ExternalAPI["External Api Service"]
ExternalAPI --> CoreAPI["API Service Core"]
CoreAPI --> DataLayer["Mongo / Pinot / Cassandra"]
CoreAPI --> Streaming["Kafka / Stream Service"]
ExternalAPI --> Tools["Integrated Tools"]
Role in platform:
The External Api Service Core Rest And Dto module is the external-facing REST gateway for OpenFrame integrations. It:
It forms a critical boundary between external systems and the internal OpenFrame platform architecture.