DAFMan RESTful API - version 2
This HTTP-based API provides access to DAFMan's database actions. Usually it's accessible at http://server/dafman/v2/ or https://server/dafman/v2/.
Resource and method summary
Resource | GET | PUT | POST | DELETE |
---|---|---|---|---|
/alarms/ |
get List of Alarms | |||
/alarms/names |
get List of Alarms' names | |||
/alarms/:name |
get Alarm | Create / update Alarm | Delete Alarm | |
/commands/ |
get List of Commands | |||
/commands/names |
get List of Commands' names | |||
/commands/:name |
get Command | Create / update Command | Delete Command | |
/connectors/ |
get List of Connectors | |||
/connectors/names |
get List of Connectors' names | |||
/connectors/:name |
get Connector | Create / update Connector | Delete Connector | |
/cfgdb/database |
get dafman database | Replace database | ||
/cfgdb/render |
get render status | Render config | ||
/cfgfb/txn |
Perform ops in one transaction | |||
/function-modules/ |
get List of Function modules | |||
/function-modules/names |
get List of Function modules' names | |||
/function-modules/:name |
get Function module | Create / update Function module | Delete Alarm | |
/function-modules/:name/executable |
get Function module executable | Replace executable | Delete executable | |
/function-modules/:name/executable-stat |
get Function module executable stat | |||
/measurements/ |
get List of Measurements | |||
/measurements/names |
get List of Measurements' names | |||
/measurements/:name |
get Measurement | Create / update Measurement | Delete Measurement | |
/providers/ |
get List of Providers | |||
/providers/names |
get List of Providers' names | |||
/providers/:name |
get Provider | Create / update Provider | Delete Provider | |
/stacks/connector/ |
get List of Connectors' Stacks | |||
/stacks/connector/names |
get List of Connectors' Stack names | |||
/stacks/connector/:name |
get Connector Stack | |||
/stacks/provider/ |
get List of Providers' Stacks | |||
/stacks/provider/names |
get List of Providers' Stacks-names | |||
/stacks/provider/:name |
get Provider Stack |
Resource details
This chapter covers details of individual resources and methods.
Path parameters
Name | Data type | Description |
---|---|---|
:name | identifier | Object / resource name (unique identificator) |
Query parameters
When parameters are referenced in subsequent chapters, required ones marked with asterisk(*).
Name | Data type | Description |
---|---|---|
names | comma-separated list of identifiers | Limit operation to names listed |
force | boolean | Force operation |
commit | boolean | Commit(1) or Rollback(0) transaction |
render | boolean | Render database on success |
Alarms
GET /alarms/names
Get names of all alarms as Array<String>
.
Status Code | Response | Description |
---|---|---|
200 | Array<String> |
Success |
500 | Error | Cannot get list of Alarms' names |
GET /alarms/
Get properties of alarms as Array<Object>
. Result schema is alarms.json.
- query parameters: names
Status Code | Response | Description |
---|---|---|
200 | Array<Object> |
Success |
400 | Bad Request | Query parameters invalid |
500 | Error | Cannot get list of Alarms |
Alarm
GET /alarms/:name
Get properties of the alarm as Object
. Result schema is alarm.json.
Status Code | Response | Description |
---|---|---|
200 | Object |
Success |
404 | Not Found | Alarm does not exists |
500 | Error | Cannot get Alarm |
PUT /alarms/:name
Create or update the alarm configuration. Request schema is alarm.json.
Status Code | Response | Description |
---|---|---|
204 | Success | |
400 | Bad Request | JSON invalid |
500 | Error | Cannot create / update Alarm |
DELETE /alarms/:name
Delete the alarm configuration from database.
Status Code | Response | Description |
---|---|---|
204 | Success | |
404 | Not Found | Alarm does not exists |
500 | Error | Cannot delete Alarm |
Commands
GET /commands/names
Get names of all commands as Array<String>
.
Status Code | Response | Description |
---|---|---|
200 | Array<String> |
Success |
500 | Error | Cannot get list of Commands' names |
GET /commands/
Get properties of commands as Array<Object>
. Result schema is commands.json.
- query parameters: names
Status Code | Response | Description |
---|---|---|
200 | Array<Object> |
Success |
400 | Bad Request | Query parameters invalid |
500 | Error | Cannot get list of Commands |
Command
GET /commands/:name
Get properties of the command as Object
. Result schema is command.json.
Status Code | Response | Description |
---|---|---|
200 | Object |
Success |
404 | Not Found | Command does not exists |
500 | Error | Cannot get Command |
PUT /commands/:name
Create or update the command configuration. Request schema is command.json.
Status Code | Response | Description |
---|---|---|
204 | Success | |
400 | Bad Request | JSON invalid |
500 | Error | Cannot create / update Command |
DELETE /commands/:name
Delete the command configuration from database.
Status Code | Response | Description |
---|---|---|
204 | Success | |
404 | Not Found | Command does not exists |
500 | Error | Cannot delete Command |
Database
GET /cfgdb/database
Get dafman sqlite3 database as Content-type: application/x-sqlite3
.
Status Code | Response | Description |
---|---|---|
200 | dafman.sqlite3 |
Success |
500 | Error | Cannot get database |
POST /cfgdb/database
Replace configuration database. Request file must be a valid .sqlite3
file and headers should be set to Content-type: application/x-sqlite3
Status Code | Response | Description |
---|---|---|
204 | Success | |
500 | Error | Replace failed |
POST /cfgdb/txn
Perform operations defined in request body. Request body schema is txn.json
- query parameters: commit, render
Status Code | Response | Description |
---|---|---|
204 | Operations performed | |
400 | Error | Request does not conform to schema |
500 | Error | Operation failed due to server error |
Measurements
GET /measurements/names
Get names of all measurements as Array<String>
.
Status Code | Response | Description |
---|---|---|
200 | Array<String> |
Success |
500 | Error | Cannot get list of Measurements' names |
GET /measurements/
Get properties of measurements as Array<Object>
. Result schema is measurements.json.
- query parameters: names
Status Code | Response | Description |
---|---|---|
200 | Array<Object> |
Success |
400 | Bad Request | Query parameters invalid |
500 | Error | Cannot get list of Measurements |
Measurement
GET /measurements/:name
Get properties of the Measurement as Object
. Result schema is measurement.json.
Status Code | Response | Description |
---|---|---|
200 | Object |
Success |
404 | Not Found | Measurement does not exists |
500 | Error | Cannot get Measurement |
PUT /measurements/:name
Create or update the Measurement configuration. Request schema is measurement.json.
Status Code | Response | Description |
---|---|---|
204 | Success | |
400 | Bad Request | JSON invalid |
500 | Error | Cannot create / update Measurement |
DELETE /measurements/:name
Delete the Measurement configuration from database.
Status Code | Response | Description |
---|---|---|
204 | Success | |
404 | Not Found | Measurement does not exists |
500 | Error | Cannot delete Measurement |
### Render |
GET /cfgdb/render
Get configuration render status. Result schema is render.json.
Status Code | Response | Description |
---|---|---|
200 | Object |
Success |
500 | Error | Cannot get render status |
POST /cfgdb/render
Render configuration database.
- query parameters: force - Force configuration render - render even when configuration is up to date.
Status Code | Response | Description |
---|---|---|
204 | Success | |
500 | Error | Render failed |
Providers
GET /providers/names
Get names of all providers as Array<String>
.
Status Code | Response | Description |
---|---|---|
200 | Array<String> |
Success |
500 | Error | Cannot get list of Providers' names |
GET /providers/
Get properties of providers as Array<Object>
. Result schema is stack_instantiations.json.
- query parameters: names
Status Code | Response | Description |
---|---|---|
200 | Array<Object> |
Success |
400 | Bad Request | Query parameters invalid |
500 | Error | Cannot get list of Providers |
Provider
GET /providers/:name
Get properties of the Provider as Object
. Result schema is stack_instantiation.json.
Status Code | Response | Description |
---|---|---|
200 | Object |
Success |
404 | Not Found | Provider does not exists |
500 | Error | Cannot get Provider |
PUT /providers/:name
Create or update the Provider configuration. Request schema is stack_instantiation.json.
Status Code | Response | Description |
---|---|---|
204 | Success | |
400 | Bad Request | JSON invalid |
500 | Error | Cannot create / update Provider |
DELETE /providers/:name
Delete the Provider configuration from database.
Status Code | Response | Description |
---|---|---|
204 | Success | |
404 | Not Found | Provider does not exists |
500 | Error | Cannot delete Provider |
Connectors
GET /connectors/names
Get names of all connectors as Array<String>
.
Status Code | Response | Description |
---|---|---|
200 | Array<String> |
Success |
500 | Error | Cannot get list of Connectors' names |
GET /connectors/
Get properties of connectors as Array<Object>
. Result schema is stack_instantiations.json.
- query parameters: names
Status Code | Response | Description |
---|---|---|
200 | Array<Object> |
Success |
400 | Bad Request | Query parameters invalid |
500 | Error | Cannot get list of Connectors |
Connector
GET /connectors/:name
Get properties of the Connector as Object
. Result schema is stack_instantiation.json.
Status Code | Response | Description |
---|---|---|
200 | Object |
Success |
404 | Not Found | Connector does not exists |
500 | Error | Cannot get Connector |
PUT /connectors/:name
Create or update the Connector configuration. Request schema is stack_instantiation.json.
Status Code | Response | Description |
---|---|---|
204 | Success | |
400 | Bad Request | JSON invalid |
500 | Error | Cannot create / update Connector |
DELETE /connectors/:name
Delete the Connector configuration from database.
Status Code | Response | Description |
---|---|---|
204 | Success | |
404 | Not Found | Connector does not exists |
500 | Error | Cannot delete Connector |
Function modules
GET /function-modules/names
Get names of all function modules as Array<String>
.
Status Code | Response | Description |
---|---|---|
200 | Array<String> |
Success |
500 | Error | Cannot get list of Function modules' names |
GET /function-modules/
Get properties of function modules as Array<Object>
. Result schema is function_modules.json.
- query parameters: names
Status Code | Response | Description |
---|---|---|
200 | Array<Object> |
Success |
400 | Bad Request | Query parameters invalid |
500 | Error | Cannot get list of Function modules |
Function module
GET /function-modules/:name
Get properties of the Function module as Object
. Result schema is function_modules.json.
Status Code | Response | Description |
---|---|---|
200 | Object |
Success |
404 | Not Found | Function module does not exists |
500 | Error | Cannot get Function module |
PUT /function-modules/:name
Create or update the Function module configuration. Request schema is function_modules.json.
Status Code | Response | Description |
---|---|---|
204 | Success | |
400 | Bad Request | JSON invalid |
500 | Error | Cannot create / update Function module |
DELETE /function-modules/:name
Delete the Function module configuration from database.
Status Code | Response | Description |
---|---|---|
204 | Success | |
404 | Not Found | Function module does not exists |
500 | Error | Cannot delete Function module |
GET /function-modules/:name/executable
Get Function module executable as Content-type: application/octet-stream
.
Status Code | Response | Description |
---|---|---|
200 | Object |
Success |
404 | Not Found | Function module does not exists |
500 | Error | Cannot get executable |
PUT /function-modules/:name/executable
Replace Function module executable. Request headers should be set to Content-type: application/octet-stream
Status Code | Response | Description |
---|---|---|
204 | Success | |
400 | Bad Request | JSON invalid |
500 | Error | Executable replace failed |
DELETE /function-modules/:name/executable
Delete Function module executable.
Status Code | Response | Description |
---|---|---|
204 | Success | |
403 | Forbidden | Deletion forbidden by OS |
404 | Not Found | Function module does not exists |
500 | Error | Cannot delete executable |
GET /function-modules/:name/executable-stat
Get Function module executable stat as Object
. Result schema is executable_stat.json.
Status Code | Response | Description |
---|---|---|
200 | Object |
Success |
404 | Not Found | Function module does not exists |
500 | Error | Cannot get executable stat |
Stacks
GET /stacks/connector/names
GET /stacks/provider/names
Get names of all stacks for Connector or Provider as Array<String>
.
Status Code | Response | Description |
---|---|---|
200 | Array<String> |
Success |
500 | Error | Cannot get list of Stacks' names |
GET /stacks/connector/
GET /stacks/provider/
Get properties of stack Connector or Provider as Array<Object>
. Result schema is stacks.json.
- query parameters: names
Status Code | Response | Description |
---|---|---|
200 | Array<Object> |
Success |
400 | Bad Request | Query parameters invalid |
500 | Error | Cannot get list of Stacks |
Stack
GET /stacks/connector/:name
GET /stacks/provider/:name
Get properties of the Stack as Object
. Result schema is stack.json.
Status Code | Response | Description |
---|---|---|
200 | Object |
Success |
404 | Not Found | Stack does not exists |
500 | Error | Cannot get Stack |
JSON schemas
Download schemas archive here
Top-level document schemas
alarm.json
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "Alarm schema",
"type": "object",
"properties": {
"name": {
"title": "Unique name",
"$ref": "identifier.json"
},
"description": {
"title": "Alarm description",
"type": "string"
},
"severity": { "$ref": "severity.json" },
"archMode": {
"title": "Archivation mode",
"type": "string",
"enum": [ "none", "change" ]
},
"ackMode": {
"title": "Acknowledge mode",
"type": "string",
"enum": [ "manual", "auto" ]
},
"enabled": {
"type": "boolean"
},
"trgMeasurement": {
"type": "string",
"title": "Trigger measurement"
},
"trgOperator": {
"type": "string",
"title": "Trigger operator",
"enum": [ "lt", "gt", "le", "ge", "eq", "ne" ]
},
"trgRefValue": {
"type": "string",
"title": "Reference value"
},
"trgHysteresis": {
"type": "string",
"title": "Alarm hysteresis"
},
"groupName": {
"type": "string",
"title": "Alarm group name"
},
"properties": { "$ref": "properties.json" }
},
"required": [ "name", "severity" ]
}
alarms.json
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "Map of alarms (name -> alarm)",
"type": "object",
"patternProperties": {
"[_a-zA-Z0-9]": { "$ref": "alarm.json" }
}
}
render.json
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "Render schema",
"type": "object",
"properties": {
"up_to_date": {
"title": "Configuration render up-to-date status",
"type": "boolean"
}
},
"required": [ ]
}
communication_object.json
This is not true top-level document, but is a base schema for measurement.json and command.json.
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "Communication object schema",
"type": "object",
"properties": {
"name": {
"title": "Unique name",
"$ref": "identifier.json"
},
"address": { "type": "string" },
"description": { "type": "string" },
"datatype": {
"title": "Datatype",
"$ref": "datatype.json"
},
"rawDatatype": {
"title": "Raw datatype",
"$ref": "datatype.json"
},
"connectorName": {
"title": "Name of Connector",
"type": "string"
},
"rawRangeLo": {
"title": "Raw range low",
"type": "string"
},
"rawRangeHi": {
"title": "Raw range high",
"type": "string"
},
"euRangeLo": {
"title": "Engineering unit range low",
"type": "string"
},
"euRangeHi": {
"title": "Engineering unit range high",
"type": "string"
},
"providerAddresses": {
"title": "Provider Addresses",
"type": "object",
"patternProperties": {
".{1,}": { "type": "string" }
}
},
"archMode": {
"title": "Archivation mode",
"type": "string",
"enum": [ "none", "change" ]
},
"archPeriod": {
"title": "Archivation period",
"type": "integer"
},
"archValueDeadband": {
"title": "Archivation value deadband",
"type": "string"
},
"archTimeDeadband": {
"title": "Archivation time deadband [ms]",
"type": "integer"
},
"leader": { "type": "string" },
"stackUmask": {
"title": "Stack umask (disabled modules / features)",
"type": "integer"
},
"eu": {
"title": "Engineering unit",
"type": "string"
},
"enabled": { "type": "boolean" },
"properties": { "$ref": "properties.json" }
},
"required": [ "name", "datatype" ]
}
measurement.json
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "Measurement schema",
"type": "object",
"allOf": [
{ "$ref": "communication_object.json" },
{
"type": "object",
"properties": {
"deadband": {
"type": "string"
}
},
"required": []
}
]
}
measurements.json
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "Map of measurements (name -> measurement)",
"type": "object",
"patternProperties": {
"[_a-zA-Z0-9]": { "$ref": "measurement.json" }
}
}
command.json
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "Command schema",
"type": "object",
"allOf": [
{ "$ref": "communication_object.json" },
{
"type": "object",
"properties": {
"initialValue": {
"title": "Command initial value",
"type": "string"
}
},
"required": []
}
]
}
commands.json
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "Map of commands (name -> command)",
"type": "object",
"patternProperties": {
"[_a-zA-Z0-9]": { "$ref": "command.json" }
}
}
function_module.json
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "Function module schema",
"type": "object",
"properties": {
"name": {
"title": "Unique name",
"$ref": "identifier.json"
},
"description": {
"title": "Function module description",
"type": "string"
},
"executable": {
"title": "Executable image path",
"type": "string"
},
"debug": { "type": "boolean" },
"respawn": { "type": "boolean" },
"enabled": { "type": "boolean" },
"termToKill": {
"title": "Term to kill [ms]",
"type": "integer"
},
"queryTimeout": {
"title": "Query Timeout [ms]",
"type": "integer"
},
"runMode": {
"title": "Run mode",
"type": "string"
},
"properties": { "$ref": "properties.json" },
"env": {
"title": "Environment variables",
"type": "object",
"patternProperties": {
".{1,}": { "type": "string" }
}
}
},
"required": [ "name", "termToKill", "queryTimeout" ]
}
function_modules.json
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "Map of function modules (name -> function module)",
"type": "object",
"patternProperties": {
"[_a-zA-Z0-9]": { "$ref": "function_module.json" }
}
}
stack_instantiation.json
This is mutual schema for Connector and Provider.
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "Stack Instantiation (Connector / Provider) schema",
"type": "object",
"properties": {
"name": {
"title": "Unique name",
"$ref": "identifier.json"
},
"stackName": {
"title": "Stack name",
"type": "string"
},
"wdtMeasurement": {
"title": "Watchdog measurement name",
"type": "string"
},
"vars": {
"title": "Variables",
"type": "object",
"patternProperties": {
".{1,}": { "type": "string" }
}
},
"properties": { "$ref": "properties.json" }
},
"required": [ "name" ]
}
stack_instantiations.json
This is mutual schema for Connectors and Providers
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "Map of stack instantiations (name -> connector / provider)",
"type": "object",
"patternProperties": {
"[_a-zA-Z0-9]": { "$ref": "stack_instantiation.json" }
}
}
stack.json
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "Stack schema",
"type": "object",
"properties": {
"name": {
"title": "Unique name",
"$ref": "identifier.json"
},
"description": {
"title": "Stack description",
"type": "object"
},
"defaults": {
"title": "Stack defaults",
"type": "object"
}
},
"required": [ "name" ]
}
stacks.json
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "Map of stacks (name -> stack)",
"type": "object",
"patternProperties": {
"[_a-zA-Z0-9]": { "$ref": "stack.json" }
}
}
executable_stat.json
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "Function module executable stat schema",
"type": "object",
"properties": {
"mode": { "type": "integer" },
"uid": { "type": "integer" },
"gid": { "type": "integer" },
"size": { "type": "integer" },
"atime": { "type": "integer" },
"mtime": { "type": "integer" },
"ctime": { "type": "integer" }
},
"required": []
}
txn.json
Basic type schemas
datatype.json
{
"$schema": "http://json-schema.org/draft-07/schema#",
"enum": [ "b", "q", "i", "l", "f", "d", "s" ]
}
identifier.json
{
"$schema": "http://json-schema.org/draft-07/schema#",
"pattern": "^[_a-zA-Z0-9]{1,64}$"
}
severity.json
Numeric alarm severity value.
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "Alarm severity",
"type": "integer",
"minimum": 0,
"description": "Alarm with severity 0 is the most severe. Severity decreased with its value rising."
}
properties.json
Additional objects' properties
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "Map of properties ( Map<String, String> ))",
"type": "object",
"patternProperties": {
".{1,}": { "type": "string" }
}
}