---
title: Unified access interface
description: The universal REST API and query language that give applications a single, standardized way to access the system's data and functions.
weight: 2
---

import Alert from '@/components/docs/Alert.astro';

## Universal REST API

The system implements a universal REST API that provides consistent interaction between different systems, applications and devices. It allows abstracting from implementation details and provides a standardized way to access data and functions of the system.

The implemented REST API service has the following data handling characteristics:

- **Uniformity**: All requests and responses follow the same format.
- **Scalability**: Supports working with a large number of devices and users.
- **Security**: Provides authentication, authorization, and data encryption.
- **Documentation**: Has clear documentation for developers.

The service significantly facilitates further work with data:

- **Simplified integration**: Different systems and devices can interact through a single interface.
- **Hardware abstraction**: Applications are not dependent on specific devices or protocols.
- **Centralized management**: All data requests go through a single point of entry.
- **Flexibility**: Easily add new features or modify existing features.

<Alert type="note">
  The REST API service is described in more detail in the [API Reference](/en/api/v1) section
</Alert>

#### Example of a universal REST API request

Data request:

```bash title="Request example"
GET /api/v1/channel_data?equipment_id=1&archive_type=daily&channel_id=3
```

Response:

```json title="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 Universal REST API

The implemented REST API service is a powerful system 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

To organize a unified data access interface, Query Language is used to allow users and applications to interact with a 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:

- **Simplify data manipulation**: Users can retrieve data without having to write complex code.
- **Standardization**: A single language for all data operations.
- **Flexibility**: Ability to run both simple and complex queries.
- **Integration**: Easily integrates with various systems and applications.

### Примеры языков запросов, используемых в системе

#### 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:

```sql title="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:

```bash title="Request example"
GET /api/v1/channel_data?equipment_id=1&channel_id=101
```

#### Active Record Query Interface

The _Ruby On Rails_ framework platform implements _Active Record (Active Record Query Interface)_, which allows you to query Databases without using SQL.

Here is an example of an _Active Record_ query to retrieve data:

```ruby title="Active record example"
ChannelDatum.where(equipment_id: 1, archive_type_id: 4)
```
