Unified access interface

The universal REST API and query language that give applications a single, standardized way to access the system's data and functions.

Universal REST API

The system implements a universal REST API that provides a consistent interaction between different systems, applications, and devices. It abstracts away implementation details and provides a standardized way to access the system’s data and functions.

The REST API service has the following data-handling characteristics:

  • Uniformity: All requests and responses follow the same format.
  • Scalability: Supports a large number of devices and users.
  • Security: Provides authentication, authorization, and data encryption.
  • Documentation: Has clear documentation for developers.

The service significantly simplifies further work with data:

  • Simplified integration: Different systems and devices can interact through a single interface.
  • Hardware abstraction: Applications do not depend on specific devices or protocols.
  • Centralized management: All data requests go through a single point of entry.
  • Flexibility: New features can be added or existing ones modified with ease.

Example of a universal REST API request

Data request:

Request example
GET /api/v1/channel_data?equipment_id=1&archive_type=daily&channel_id=3

Response:

Response example
[
  {
    "id": 123,
    "equipment_id": 1,
    "seance_id": 2,
    "channel_id": 3,
    "archive_type_id": 4,
    "value": 42.5,
    "event_time": 1739950861
  }
]

Benefits of the universal REST API

The REST API service is a powerful tool that creates a unified data access interface.

It allows you to:

  • Abstract away from specific devices and technologies.
  • Ensure consistency and ease of use.
  • Simplify the integration of new systems and devices.

Query language

Building on this unified data access interface, the system uses a query language so that users and applications can interact with the database to retrieve, modify, or manage information. A universal query language provides consistency, ease of use, and powerful data-manipulation capabilities.

The query language provides the following capabilities:

  • Simplified data manipulation: Users can retrieve data without writing complex code.
  • Standardization: A single language for all data operations.
  • Flexibility: The ability to run both simple and complex queries.
  • Integration: Easily integrates with various systems and applications.

Example query languages used in the system

SQL (Structured Query Language)

The PostgreSQL DBMS uses the SQL query language to work with data. It supports basic data-manipulation operations.

An example of an SQL query for data retrieval:

example.sql
SELECT id, channel_id, value
FROM channel_data
WHERE equipment_id = 1 AND archive_type_id = 4;

REST interface with parameters

The universal REST API implements a REST interface with parameters as part of its interaction with data. This allows the API to use query parameters to filter data.

For example:

Request example
GET /api/v1/channel_data?equipment_id=1&channel_id=101

Active Record Query Interface

The Ruby on Rails framework implements Active Record (the Active Record Query Interface), which lets you query databases without using SQL.

Here is an example of an Active Record query to retrieve data:

Active record example
ChannelDatum.where(equipment_id: 1, archive_type_id: 4)

Related topics

Last updated on

Was this page helpful?