Managing Meters with the API
Meters are the customer-specific buckets of usage for the different meter types. When a customer opts for a meter type, then the meter needs to be created with the following parameters:
Meter Key (the Meter processor where the usage data is guided)
Meter Type ID (the meter type the usage should be aggregated for)
User ID (the customer)
Meters can be created, retrieved, updated, and deleted using the API, see API Reference.
The meter inherits the following properties from the meter type stated when creating the meter:
Active from - The meter is active from the date time defined in the Active from field in the meter type. If Active from is set to a time before the meter creation time then the meter will be activated as soon as it is created. The time is calculated based on the timezone defined in the meter type when the meter type is created in the user interface.
Active to - The meter is active to the date time defined in the Active to field on the meter type. The time is calculated based on the timezone defined in the meter type when the meter type is created in the user interface.
Unit - This is the unit in which the metered record value will be counted, such as minutes, days, or number of coffee cups for a coffee service.
Aggregation type - The meter’s usage is aggregated according to the aggregation defined in the meter type.
Reset schedule - The meter follows the Reset schedule defined in the meter type. The period end of the meter is calculated based on the Reset schedule. The timezone defined in meter type is considered when calculating period start and period end, see Flushing Metered Records.
When a meter is first created, its period start is set to the time of creation in the selected timezone. This is shown in the Period start field in the Meter Inspector.
When updating a meter, you can update the parameter “deleteOnReset“. It has a default value of false, but can be set to either ‘true’ or ‘false’. If you set it to true, the meter will be deleted when the current period ends after sending the metered record to downstream systems.
Note!
A meter can be created at any time using the API once the meter type and a stream with a Meter processor have been created.
Â