REST API

EPyT-Flow comes with a REST API for supporting the integration into other projects such as web applications. The REST server is based on Falcon and is implemented in the class RestApiService – it runs on port 8080 as a default. It provides the following methods:

Method

URL

Implementation

Description

POST

/scenario/new

ScenarioNewHandler

Creates a new scenario (based on a given .inp and .msx file, or on a given scenario configuration).

DELETE

/scenario/{scenario_id}

ScenarioRemoveHandler

Deletes a scenario.

GET

/scenario/{scenario_id}/export

ScenarioExportHandler

Exports a given scenario to an .inp and (optionally) .msx file.

GET

/scenario/{scenario_id}/topology

ScenarioTopologyHandler

Gets the topology of a given scenario.

GET

/scenario/{scenario_id}/scenario_config

ScenarioConfigHandler

Gets the entire configuration/specification of a given scenario.

GET, POST

/scenario/{scenario_id}/general_params

ScenarioGeneralParamsHandler

Gets the general parameters (e.g. simulation duration, etc.) of a given scenario.

GET, POST

/scenario/{scenario_id}/quality_params

ScenarioQualityParamsHandler

Gets or sets the (EPANET) quality parameters of a given scenario.

GET, POST

/scenario/{scenario_id}/sensor_config

ScenarioSensorConfigHandler

Gets or sets the sensor configuration of a given scenario.

GET, POST

/scenario/{scenario_id}/uncertainty/model

ScenarioModelUncertaintyHandler

Gets or sets the model uncertainties of a given scenario.

GET, POST

/scenario/{scenario_id}/uncertainty/sensors

ScenarioSensorUncertaintyHandler

Gets or sets the sensor uncertainties (i.e. noise) of a given scenario.

GET, POST

/scenario/{scenario_id}/controls/simple

ScenarioSimpleControlHandler

Gets or adds simple control modules to a given scenario.

GET, POST

/scenario/{scenario_id}/controls/complex

ScenarioComplexControlHandler

Gets or adds complex control modules to a given scenario.

GET, POST

/scenario/{scenario_id}/events/quality

ScenarioQualityEventHandler

Gets or adds quality events (e.g. injection events) to a given scenario.

GET, POST

/scenario/{scenario_id}/events/leakages

ScenarioLeakageHandler

Gets or adds a leakage to a given scenario.

GET, POST

/scenario/{scenario_id}/events/sensor_faults

ScenarioSensorFaultHandler

Gets or adds a sensor fault to a given scenario.

GET, POST

/scenario/{scenario_id}/events/sensor_reading_attacks

ScenarioSensorReadingAttackHandler

Gets or adds a sensor reading attack to a given scenario.

POST

/scenario/{scenario_id}/node/{node_id}/demand_pattern

ScenarioNodeDemandPatternHandler

Set the demand pattern of a specific node in a given scenario.

GET, POST

/scenario/{scenario_id}/simulation

ScenarioSimulationHandler

Runs the simulation of a given scenario.

POST

/scenario/{scenario_id}/simulation/basic_quality

ScenarioBasicQualitySimulationHandler

Runs the basic quality simulation of a given scenario.

POST

/scenario/{scenario_id}/simulation/advanced_quality

ScenarioAdvancedQualitySimulationHandler

Runs the advanced quality simulation of a given scenario.

DELETE

/scada_data/{data_id}

ScadaDataRemoveHandler

Deletes a given SCADA data instance.

GET, POST

/scada_data/{data_id}/sensor_config

ScadaDataSensorConfigHandler

Gets or sets the sensor configuration of a given SCADA data instance.

GET, POST

/scada_data/{data_id}/sensor_faults

ScadaDataSensorFaultsHandler

Gets or sets the sensor faults of a given SCADA data instance.

GET

/scada_data/{data_id}/nodes/pressures

ScadaDataPressuresHandler

Gets all pressure sensor readings of a given SCADA data instance.

GET

/scada_data/{data_id}/nodes/demands

ScadaDataDemandsHandler

Gets all demand sensor readings of a given SCADA data instance.

GET

/scada_data/{data_id}/nodes/bulk_species

ScadaDataNodeBulkSpeciesHandler

Gets all bulk species node sensor readings of a given SCADA data instance.

GET

/scada_data/{data_id}/nodes/quality

ScadaDataNodesQualityHandler

Gets all node quality sensor readings of a given SCADA data instance.

GET

/scada_data/{data_id}/links/flows

ScadaDataFlowsHandler

Gets all flow sensor readings of a given SCADA data instance.

GET

/scada_data/{data_id}/links/quality

ScadaDataLinksQualityHandler

Gets all link quality sensor readings of a given SCADA data instance.

GET

/scada_data/{data_id}/links/bulk_species

ScadaDataLinkBulkSpeciesHandler

Gets all sbulk species link ensor readings of a given SCADA data instance.

GET

/scada_data/{data_id}/links/surface_species

ScadaDataSurfaceSpeciesHandler

Gets all demand sensor readings of a given SCADA data instance.

GET

/scada_data/{data_id}/pump_states

ScadaDataPumpStatesHandler

Gets all demand sensor readings of a given SCADA data instance.

GET

/scada_data/{data_id}/valve_states

ScadaDataValveStatesHandler

Gets all demand sensor readings of a given SCADA data instance.

GET

/scada_data/{data_id}/tank_volumes

ScadaDataTankVolumesHandler

Gets all demand sensor readings of a given SCADA data instance.

GET

/scada_data/{data_id}/export/xlsx

ScadaDataXlsxExportHandler

Exports a given SCADA data instance to a .xlsx file.

GET

/scada_data/{data_id}/export/matlab

ScadaDataMatlabExportHandler

Exports a given SCADA data instance to a Matlab data file.

GET

/scada_data/{data_id}/export/numpy

ScadaDataNumpyExportHandler

Exports a given SCADA data instance to a Numpy data file.

GET

/scada_data/{data_id}/export

ScadaDataExportHandler

Exports a given SCADA data instance to an .epytflow_scada_data data file.

POST

/scada_data/{data_id}/convert_units

ScadaDataConvertUnitsHandler

Converts the units of a given SCADA data instance and returns a new SCADA data instance.