[][src]Module exonum_system_api::public

Public part of the node REST API.

Public API includes universally available endpoints, e.g., allowing to view the list of services on the current node.

Table of Contents

Network Statistics

PropertyValue
Path/api/system/v1/stats
MethodGET
Query type-
Return typeStatsInfo

Returns information about the current state of the node memory pool.

use exonum_system_api::{public::StatsInfo, SystemApiPlugin};
use exonum_testkit::{ApiKind, TestKitBuilder};

let mut testkit = TestKitBuilder::validator()
    .with_plugin(SystemApiPlugin)
    .build();
let api = testkit.api();
let stats: StatsInfo = api.public(ApiKind::System).get("v1/stats")?;

Node Health Info

PropertyValue
Path/api/system/v1/healthcheck
MethodGET
Query type-
Return typeHealthCheckInfo

Returns information about whether the node is connected to other peers and its consensus status.

use exonum_system_api::{public::HealthCheckInfo, SystemApiPlugin};
use exonum_testkit::{ApiKind, TestKitBuilder};

let mut testkit = TestKitBuilder::validator()
    .with_plugin(SystemApiPlugin)
    .build();
let api = testkit.api();
let info: HealthCheckInfo = api.public(ApiKind::System).get("v1/healthcheck")?;

User Agent

PropertyValue
Path/api/system/v1/user_agent
MethodGET
Query type-
Return typeString

Returns an user agent of the node.

User agent includes versions of Exonum and the Rust compiler and the OS info, all separated by slashes.

use exonum_system_api::SystemApiPlugin;
use exonum_testkit::{ApiKind, TestKitBuilder};

let mut testkit = TestKitBuilder::validator()
    .with_plugin(SystemApiPlugin)
    .build();
let api = testkit.api();
let user_agent: String = api.public(ApiKind::System).get("v1/user_agent")?;

let components: Vec<_> = user_agent.split('/').collect();
assert_eq!(components.len(), 3);
let exonum_version = components[0];
let rust_version = components[1];
let os_version = components[2];

Available Services

PropertyValue
Path/api/system/v1/services
MethodGET
Query type-
Return typeDispatcherInfo

Returns information about services available in the network.

use exonum_system_api::{public::DispatcherInfo, SystemApiPlugin};
use exonum_testkit::{ApiKind, TestKitBuilder};

let mut testkit = TestKitBuilder::validator()
    .with_plugin(SystemApiPlugin)
    .build();
let api = testkit.api();
let user_agent: DispatcherInfo = api.public(ApiKind::System).get("v1/services")?;

Structs

DispatcherInfo

Services info response.

HealthCheckInfo

Information about whether the node is connected to other peers and its consensus status.

StatsInfo

Information about the current state of the node memory pool.

Enums

ConsensusStatus

Information about whether it is possible to achieve the consensus between validators in the current state.