Download OpenAPI specification:Download
Utilitarian API is a software for Multi Utility AMR (Automatic Meter Reading) built by Palmlund Wahlgren Innovative Technology AB and is targeted to utility organisations that require a more open solution for their AMR Operations.
The source for this documentation can be found on github.com. If you find any errors in the documentation or you have suggestions on how to make it better please create an issue on Github.
Utilitarian API is a RESTful API that exposes endpoint for AMR Operations.
The common part deals with general aspects of the API.
Under the Metering part all endpoints for the management of Meter Devices and Meter Readings are gathered.
Under the Jobs part all endpoint for managing the pulling meter data and communication to with Meter Devices are gathered. (Ongoing work)
Each user is given a unique API Key Token to interact with the API. It is also possible to use basic auth but not recomended.
For clients to authenticate, the token key should be included in the
Authorization
HTTP header. The key should be prefixed by the string
literal "Token", with whitespace separating the two strings. For example:
Authorization: Token 9944b09199c62bcf9418ad846dd0e4bbdfc6ee4b
Unauthenticated responses that are denied permission will result in an
HTTP 401 Unauthorized
response with an appropriate
WWW-Authenticate header. For example:
WWW-Authenticate: Token
Note: If you are running an instance of Utilitarian API that is accessable over the Internet you need to make sure that the API is only served under
https
.
The Pagination scheme used for Utiltiarian API is a Limit/Offset scheme.
By using a limit indicates the maximum number of items to return and the offset indicates the starting position of the query in relation to the complete set of unpaginated items. This makes for a very extensible pagination scheme where the client have better control of the returned values. In all responses the total count of items in the compleate set of unpaginated items are returned to be able to know where in the set a pagination response is located.
The limit and offset is applied in query parameters like:
GET https://api.example.org/accounts/?limit=100&offset=400
The following example shows a common result set.
{
"count": 1023
"next": "https://api.example.org/accounts/?limit=100&offset=500",
"previous": "https://api.example.org/accounts/?limit=100&offset=300",
"results": [
…
]
}
Note: Having very large result sets can lead to significant performance issues.
Operations on Meter Devices
Meter Devices are the entity that represents a physical (or logical) meter deployed in the field. They handle all information about how to communicate with the meter and how to interpret the data from the meter.
Returns a list of MeterDevices
name | string |
external_system_reference | string |
manufacturer_serial | string |
dlms_logical_device_name | string |
dlms_system_title | string |
limit | integer Number of results to return per page. |
offset | integer The initial index from which to return the results. |
OK
Creates a MeterDevice
name required | string (Unique Name/Identification of Meter) [ 1 .. 50 ] characters |
external_system_reference | string (Reference in external systems. Used for export) <= 50 characters Nullable |
manufacturer_serial | string (Meter Serial Number from manufacturer) <= 50 characters Nullable |
protocol required | string (The communication protocol used by the meter device) Enum:"dlms-cosem" "iec62056-21" "i-flag" "mbus" "modbus" "lis-200" |
iec62056_21_address | string (Meter Address used for IEC62056-21 communication) <= 8 characters Nullable |
dlms_logical_device_name | string (Logical device name used in DLMS Communication) [ 1 .. 32 ] characters Nullable ^[abcdefABCDEF1234567890]*$ |
dlms_system_title | string (System title of meter used in DLMS communication) [ 1 .. 16 ] characters Nullable ^[abcdefABCDEF1234567890]*$ |
type | string <uuid> (Type) Nullable |
network_interface | string <uuid> (Network interface) Nullable |
has_current_transformer | boolean (Meter has a current transformer in its measurement loop) |
current_transformer_ratio | integer (Ratio of current transformer) [ -2147483648 .. 2147483647 ] |
has_voltage_transformer | boolean (Meter has a voltage transformer in its measurement loop) |
voltage_transformer_ratio | integer (Ratio of voltage transformer) [ -2147483648 .. 2147483647 ] |
has_disconnector | boolean (Has disconnector) |
disconnector_status | integer (Disconnector status) Nullable Enum:0 1 2 |
Created
Returns a single MeterDevice
id required | string <uuid> A UUID string identifying this meter device. |
OK
Updates a single MeterDevice
id required | string <uuid> A UUID string identifying this meter device. |
name required | string (Unique Name/Identification of Meter) [ 1 .. 50 ] characters |
external_system_reference | string (Reference in external systems. Used for export) <= 50 characters Nullable |
manufacturer_serial | string (Meter Serial Number from manufacturer) <= 50 characters Nullable |
protocol required | string (The communication protocol used by the meter device) Enum:"dlms-cosem" "iec62056-21" "i-flag" "mbus" "modbus" "lis-200" |
iec62056_21_address | string (Meter Address used for IEC62056-21 communication) <= 8 characters Nullable |
dlms_logical_device_name | string (Logical device name used in DLMS Communication) [ 1 .. 32 ] characters Nullable ^[abcdefABCDEF1234567890]*$ |
dlms_system_title | string (System title of meter used in DLMS communication) [ 1 .. 16 ] characters Nullable ^[abcdefABCDEF1234567890]*$ |
type | string <uuid> (Type) Nullable |
network_interface | string <uuid> (Network interface) Nullable |
has_current_transformer | boolean (Meter has a current transformer in its measurement loop) |
current_transformer_ratio | integer (Ratio of current transformer) [ -2147483648 .. 2147483647 ] |
has_voltage_transformer | boolean (Meter has a voltage transformer in its measurement loop) |
voltage_transformer_ratio | integer (Ratio of voltage transformer) [ -2147483648 .. 2147483647 ] |
has_disconnector | boolean (Has disconnector) |
disconnector_status | integer (Disconnector status) Nullable Enum:0 1 2 |
OK
Partially updates a single MeterDevice
id required | string <uuid> A UUID string identifying this meter device. |
name required | string (Unique Name/Identification of Meter) [ 1 .. 50 ] characters |
external_system_reference | string (Reference in external systems. Used for export) <= 50 characters Nullable |
manufacturer_serial | string (Meter Serial Number from manufacturer) <= 50 characters Nullable |
protocol required | string (The communication protocol used by the meter device) Enum:"dlms-cosem" "iec62056-21" "i-flag" "mbus" "modbus" "lis-200" |
iec62056_21_address | string (Meter Address used for IEC62056-21 communication) <= 8 characters Nullable |
dlms_logical_device_name | string (Logical device name used in DLMS Communication) [ 1 .. 32 ] characters Nullable ^[abcdefABCDEF1234567890]*$ |
dlms_system_title | string (System title of meter used in DLMS communication) [ 1 .. 16 ] characters Nullable ^[abcdefABCDEF1234567890]*$ |
type | string <uuid> (Type) Nullable |
network_interface | string <uuid> (Network interface) Nullable |
has_current_transformer | boolean (Meter has a current transformer in its measurement loop) |
current_transformer_ratio | integer (Ratio of current transformer) [ -2147483648 .. 2147483647 ] |
has_voltage_transformer | boolean (Meter has a voltage transformer in its measurement loop) |
voltage_transformer_ratio | integer (Ratio of voltage transformer) [ -2147483648 .. 2147483647 ] |
has_disconnector | boolean (Has disconnector) |
disconnector_status | integer (Disconnector status) Nullable Enum:0 1 2 |
OK
Operations on Network Interfaces.
A NetworkInterface is an object holding information needed for communication to a meter device. You can connect SIM cards to a network interface. Several meter devices can share the same network interface, for example an MBus gateway. It is also possbile for several network interfaces to share the same SIM Card, for example if using the same IP/SIM-card but different devices are under different ports. Then each meter device would have its own network interface specifiying the port but they would all share the same SIM Card to get the IP address.
Some network interfaces only allows for one open connection and when the network interface is used by communication software we want to make sure that no other job is trying to communicate with the meter devcice. This is done by blocking the network interface. When the communication is done the network interface should be unblocked so that other jobs can connect to it.
Tips: The
host
parameter is only returned in responses and will contain the following data:
- FQDN. If a meter has a DNS compliant name attached to it we assume we want to use that firstly
- Static IP Address. If no FQDN is set on the meter it will return the static ip address associated with it.
- IP of SIM Card. If no static ip address or FQDN is set the meter will return the IP of the SIM Card attached to it.
returns list of NetworkInterfaces
limit | integer Number of results to return per page. |
offset | integer The initial index from which to return the results. |
OK
Create a new Network Interface
static_ip_address | string (IP Address of meter that is not bound to SIM) non-empty Nullable |
fqdn | string (FQDN, if you are using DNS to lookup IP of meters) <= 200 characters Nullable |
port | integer (Port used for IP communication) [ 0 .. 2147483647 ] Nullable |
sim | string <uuid> (Sim) Nullable |
can_block | boolean (It is possible to block the network interface) |
Created
Returns a single NetworkInterface
id required | string <uuid> A UUID string identifying this network interface. |
OK
Updates a single Network Interface
id required | string <uuid> A UUID string identifying this network interface. |
static_ip_address | string (IP Address of meter that is not bound to SIM) non-empty Nullable |
fqdn | string (FQDN, if you are using DNS to lookup IP of meters) <= 200 characters Nullable |
port | integer (Port used for IP communication) [ 0 .. 2147483647 ] Nullable |
sim | string <uuid> (Sim) Nullable |
can_block | boolean (It is possible to block the network interface) |
OK
Partially updates a single Network Interface
id required | string <uuid> A UUID string identifying this network interface. |
static_ip_address | string (IP Address of meter that is not bound to SIM) non-empty Nullable |
fqdn | string (FQDN, if you are using DNS to lookup IP of meters) <= 200 characters Nullable |
port | integer (Port used for IP communication) [ 0 .. 2147483647 ] Nullable |
sim | string <uuid> (Sim) Nullable |
can_block | boolean (It is possible to block the network interface) |
OK
Operations on SIM Cards
Utilitarian is focused on IP communication with meters. Many meter have internal or external modems that are used for cellular communications. This require a SIM-card. Many SIM-cards in IoT data plans will give a fixed IP. It is possible to store all your SIM cards in Utiltarian and link them to your meter devices for an easy way of finding the IP for a meter device. If you switch a SIM cards in the field you need to switch it in Utilitarian so that the system can find the meter device.
Tips: It is possible to save a link to the managing software, for example Jasper, of the SIM cards. In future Utilitarian UI this will be rendered as an external link to quickly get access to logs and other SIM cards operations that are not in the scope of Utilitarian.
Returns a list of SimCards
iccid | string |
imsi | string |
limit | integer Number of results to return per page. |
offset | integer The initial index from which to return the results. |
OK
Creates a new SimCard
iccid required | string (ICCID of the SIM) [ 1 .. 20 ] characters ^[0123456789]*$ |
imsi required | string (IMSI of the SIM) [ 1 .. 15 ] characters ^[0123456789]*$ |
ip_address | string (IP Address associated with the SIM) non-empty Nullable |
phone_number | string (Telephone number associated with the SIM) [ 1 .. 30 ] characters Nullable |
external_system_link | string <uri> (Link to external system for management of the SIM) [ 1 .. 200 ] characters Nullable |
Created
Returns a single SimCard
id required | string <uuid> A UUID string identifying this sim card. |
OK
Updates a single SimCard
id required | string <uuid> A UUID string identifying this sim card. |
iccid required | string (ICCID of the SIM) [ 1 .. 20 ] characters ^[0123456789]*$ |
imsi required | string (IMSI of the SIM) [ 1 .. 15 ] characters ^[0123456789]*$ |
ip_address | string (IP Address associated with the SIM) non-empty Nullable |
phone_number | string (Telephone number associated with the SIM) [ 1 .. 30 ] characters Nullable |
external_system_link | string <uri> (Link to external system for management of the SIM) [ 1 .. 200 ] characters Nullable |
OK
Partially updates a single SimCard
id required | string <uuid> A UUID string identifying this sim card. |
iccid required | string (ICCID of the SIM) [ 1 .. 20 ] characters ^[0123456789]*$ |
imsi required | string (IMSI of the SIM) [ 1 .. 15 ] characters ^[0123456789]*$ |
ip_address | string (IP Address associated with the SIM) non-empty Nullable |
phone_number | string (Telephone number associated with the SIM) [ 1 .. 30 ] characters Nullable |
external_system_link | string <uri> (Link to external system for management of the SIM) [ 1 .. 200 ] characters Nullable |
OK
Operations on Meter Device Types
It is possible to have a meter that is of same make and model but differently configured. By adding a different meter type we can have a several different setups of the same manufacturer model.
Returns a list of MeterDeviceTypess
limit | integer Number of results to return per page. |
offset | integer The initial index from which to return the results. |
OK
Creates a MeterDeviceType
name required | string (Type name of Meter) [ 1 .. 50 ] characters |
description | string (Description of Meter Device Type) <= 500 characters |
manufacturer required | string (Manufacturer name) [ 1 .. 100 ] characters |
manufacturer_model required | string (Manufacturer model name) [ 1 .. 50 ] characters |
config | string <uuid> (Config) Nullable |
Created
Returns a single MeterDeviceType
id required | string <uuid> A UUID string identifying this meter device type. |
OK
Updates a single MeterDeviceType
id required | string <uuid> A UUID string identifying this meter device type. |
name required | string (Type name of Meter) [ 1 .. 50 ] characters |
description | string (Description of Meter Device Type) <= 500 characters |
manufacturer required | string (Manufacturer name) [ 1 .. 100 ] characters |
manufacturer_model required | string (Manufacturer model name) [ 1 .. 50 ] characters |
config | string <uuid> (Config) Nullable |
OK
Partially updates a single MeterDeviceType
id required | string <uuid> A UUID string identifying this meter device type. |
name required | string (Type name of Meter) [ 1 .. 50 ] characters |
description | string (Description of Meter Device Type) <= 500 characters |
manufacturer required | string (Manufacturer name) [ 1 .. 100 ] characters |
manufacturer_model required | string (Manufacturer model name) [ 1 .. 50 ] characters |
config | string <uuid> (Config) Nullable |
OK
Operations on Meter Device Configs
A Meter Device Config stores the configurations of a Meter Device Type. As of now this stores mainly what MeteringSeries it has. The metering series list is used to validate if a meter reading from a meter device is allowed to be saved.
The plan later on is have information about what, for example COSEM objects a meter has, or what MBus Vifes etc the meter has. For example can an IDIS complient meter share configuration with other meters of different make. An OMS compliant Mbus meter can also share configuration between different manufacturers.
Returns a list of MeterDeviceConfigs
limit | integer Number of results to return per page. |
offset | integer The initial index from which to return the results. |
OK
Creates a MeterDeviceConfig
name required | string (Device Config Name) [ 1 .. 50 ] characters |
series required | Array of string <uuid> |
Created
Returns a single MeterDeviceConfig
id required | string <uuid> A UUID string identifying this meter device config. |
OK
Updates a single MeterDeviceConfig
id required | string <uuid> A UUID string identifying this meter device config. |
name required | string (Device Config Name) [ 1 .. 50 ] characters |
series required | Array of string <uuid> |
OK
Partially updates a single MeterDeviceConfig
id required | string <uuid> A UUID string identifying this meter device config. |
name required | string (Device Config Name) [ 1 .. 50 ] characters |
series required | Array of string <uuid> |
OK
Operations on Meter Reading Series
A MeterReadingSeries is used for grouping all meter values that should be viewed as a time series of values. It also adds "metadata" about the series so that it is possible to know more about the values contained in it.
In Utilitarian we aim to use OBIS codes as series identifier but there is nothing preventing the use of any identifier for a series. Simple string values like "energy" and "power" could be used or more complex identifiers like from the CIM standard.
Since we might have electricity meters that have current and voltage transformers in their measurement loops we need to specify if the series is affected by either the current transformer and/or the voltage transformer ratio.
Returns a list of MeterReadingSeries
name | string |
unit | string |
limit | integer Number of results to return per page. |
offset | integer The initial index from which to return the results. |
OK
Create a MeterReadingSeries
name required | string (Name of the series. Used to group meter readings.) [ 1 .. 50 ] characters |
description | string (Description of the series) <= 250 characters |
unit required | string (Unit characters of the series, ex: kWh) [ 1 .. 10 ] characters |
unit_description | string (Longer description of unit) [ 1 .. 250 ] characters Nullable |
si_multiplier | string <decimal> (Multiplier to get series unit in SI unit.) |
affected_by_ct_ratio | boolean (Series is affected by the current transformer of the meter) |
affected_by_vt_ratio | boolean (Series is affected by the voltage transformer of the meter) |
Created
Returns a single MeterReadingSeries
id required | string <uuid> A UUID string identifying this meter reading series. |
OK
Updates a single MeterReadingSeries
id required | string <uuid> A UUID string identifying this meter reading series. |
name required | string (Name of the series. Used to group meter readings.) [ 1 .. 50 ] characters |
description | string (Description of the series) <= 250 characters |
unit required | string (Unit characters of the series, ex: kWh) [ 1 .. 10 ] characters |
unit_description | string (Longer description of unit) [ 1 .. 250 ] characters Nullable |
si_multiplier | string <decimal> (Multiplier to get series unit in SI unit.) |
affected_by_ct_ratio | boolean (Series is affected by the current transformer of the meter) |
affected_by_vt_ratio | boolean (Series is affected by the voltage transformer of the meter) |
OK
Partially updates a single MeterReadingSeries
id required | string <uuid> A UUID string identifying this meter reading series. |
name required | string (Name of the series. Used to group meter readings.) [ 1 .. 50 ] characters |
description | string (Description of the series) <= 250 characters |
unit required | string (Unit characters of the series, ex: kWh) [ 1 .. 10 ] characters |
unit_description | string (Longer description of unit) [ 1 .. 250 ] characters Nullable |
si_multiplier | string <decimal> (Multiplier to get series unit in SI unit.) |
affected_by_ct_ratio | boolean (Series is affected by the current transformer of the meter) |
affected_by_vt_ratio | boolean (Series is affected by the voltage transformer of the meter) |
OK
Operations on Meter Readings
Meter Readings are the raw data we receive from meter devices. They are limited to numerical data. Meter Readings table is designed for short term storage of meter values.
Returns a list of MeterReadings. Supply both meter_id and series_id in query parameters to get a complete series. Returns a list of only values and timestamps. If the series and meter is omitted the values will be mixed.
meter_device | string |
series | string |
start_time | string |
end_time | string |
limit | integer Number of results to return per page. |
offset | integer The initial index from which to return the results. |
OK
Creates a MeterReading
meter_device required | string <uuid> (Meter device) |
series required | string <uuid> (Series) |
timestamp required | string <date-time> (Time when the reading was registered in the meter.) |
value required | string <decimal> (Value of the reading) |
Created
Returns a single MeterReading
id required | integer A unique integer value identifying this meter reading. |
OK
Operations on Staged Meter Readings
Staged Meter Readings are meter readings that when they where received by Utilitarian API did not have a corresponding meter. This might be due to that the meter was set up in the field but was not yet set up in Utilitarian API. To avoid loosing values we save the meter readings for a while and whenever a new meter device is created we will save all staged meter readings as normal meter readings. We also clear the staging table of old values after a set amount of time to make sure the list doesn't grow to large.
Returns list of Staged Meter Readings
meter_device_name | string |
start_time | string |
end_time | string |
limit | integer Number of results to return per page. |
offset | integer The initial index from which to return the results. |
OK
Create a new Staged Meter Readings
meter_device_name required | string (Name of Meter Device) [ 1 .. 50 ] characters |
series_name required | string (Name of Meter Reading Series) [ 1 .. 50 ] characters |
timestamp required | string <date-time> (Time when the reading was registered in the meter.) |
value required | string <decimal> (Value of the reading) |
Created
Returns a single Staged Meter Reading
id required | integer A unique integer value identifying this staged meter reading. |
OK
Updates a single Staged Meter Reading
id required | integer A unique integer value identifying this staged meter reading. |
meter_device_name required | string (Name of Meter Device) [ 1 .. 50 ] characters |
series_name required | string (Name of Meter Reading Series) [ 1 .. 50 ] characters |
timestamp required | string <date-time> (Time when the reading was registered in the meter.) |
value required | string <decimal> (Value of the reading) |
OK
Partially updates a single Staged Meter Reading
id required | integer A unique integer value identifying this staged meter reading. |
meter_device_name required | string (Name of Meter Device) [ 1 .. 50 ] characters |
series_name required | string (Name of Meter Reading Series) [ 1 .. 50 ] characters |
timestamp required | string <date-time> (Time when the reading was registered in the meter.) |
value required | string <decimal> (Value of the reading) |
OK
Operation on new meter readings
This enpoint is used by the different distributed AMR services that send data. It is not always knows by the external service what the database ID is for meter device or meter readings series. This endpoint will do lookups based on the names of the meter device and meter reading series.
Operations on Meter System Events
A MeterSystemEvent is some form of event occurring in a MeterDevice. It could be an indication that something is wrong (Alarm) or an just a log entry that the meter switched to summer time.
Returns a list of MeterSystemEvents
meter_device | string |
start_time | string |
end_time | string |
limit | integer Number of results to return per page. |
offset | integer The initial index from which to return the results. |
OK
Creates a MeterSystemEvents
meter_device required | string <uuid> (Meter device) |
timestamp required | string <date-time> (Timestamp) |
title required | string (Title of the event) [ 1 .. 50 ] characters |
content required | string (Additional information about the meter system event.) [ 1 .. 500 ] characters |
Created
Returns a single MeterSystemEvent
id required | integer A unique integer value identifying this meter system event. |
OK
Operations on Meter Security Key Collection
A Meter Security Key Collection holds all passwords, secrets and encryption keys for a meter device.
The dlms_master_key
will never be returned in any of the responses for security reasons.
Note: DLMS Keys are stored in hexadecimal strings. 128 bit key = 32 hex characters, 256 bit key = 64 hex characters.
Returns list of MeterSecurityCollections
meter | string |
meter_name | string |
meter_external_system_reference | string |
meter_manufacturer_serial | string |
meter_dlms_system_title | string |
meter_dlms_logical_device_name | string |
limit | integer Number of results to return per page. |
offset | integer The initial index from which to return the results. |
OK
Creates a MeterSecurityKeyCollection
meter required | string <uuid> (Meter) |
iec62056_21_password | string (Password for use in IEC 62056-21 communication) [ 1 .. 8 ] characters Nullable |
dlms_global_unicast_encryption_key required | string (Global Unicast Encryption Key, GUEK) [ 1 .. 64 ] characters ^[abcdefABCDEF1234567890]*$ |
dlms_global_broadcast_encryption_key required | string (Global Broadcast Encryption Key, GBEK) [ 1 .. 64 ] characters ^[abcdefABCDEF1234567890]*$ |
dlms_master_key required | string (Master Key or Key Encrypting Key, KEK) [ 1 .. 64 ] characters ^[abcdefABCDEF1234567890]*$ |
dlms_global_authentication_key required | string (Global Authentication Key, GAK) [ 1 .. 64 ] characters ^[abcdefABCDEF1234567890]*$ |
Created
Returns a single MeterSecurityKeyCollection
id required | string <uuid> A UUID string identifying this meter security key collection. |
OK