Skip to main content
POST
/
organizations
/
{orgId}
/
compoundaggregations
Create Compound Aggregation
curl --request POST \
  --url https://api.m3ter.com/organizations/{orgId}/compoundaggregations \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "name": "<string>",
  "rounding": "UP",
  "quantityPerUnit": 1,
  "unit": "<string>",
  "calculation": "<string>",
  "version": 123,
  "customFields": {},
  "code": "example_code",
  "accountingProductId": "<string>",
  "productId": "<string>",
  "evaluateNullAggregations": true
}
'
{
  "id": "<string>",
  "version": 123,
  "customFields": {},
  "name": "<string>",
  "rounding": "UP",
  "quantityPerUnit": 123,
  "unit": "<string>",
  "code": "<string>",
  "segments": [
    {}
  ],
  "accountingProductId": "<string>",
  "calculation": "<string>",
  "productId": "<string>",
  "evaluateNullAggregations": true,
  "dtCreated": "2023-11-07T05:31:56Z",
  "dtLastModified": "2023-11-07T05:31:56Z",
  "createdBy": "<string>",
  "lastModifiedBy": "<string>"
}

Documentation Index

Fetch the complete documentation index at: https://docs.m3ter.com/llms.txt

Use this file to discover all available pages before exploring further.

Authorizations

Authorization
string
header
required

m3ter supports machine to machine authentication using the clientCredentials OAuth2 flow.

The authorizationCode flow controls access for human users via the m3ter Console application.

Path Parameters

orgId
string
required

The unique identifier (UUID) for your Organization. The Organization represents your company as a direct customer of our service.

Body

application/json
name
string
required

Descriptive name for the Aggregation.

Required string length: 1 - 200
rounding
enum<string>
required

Specifies how you want to deal with non-integer, fractional number Aggregation values.

NOTES:

  • NONE is default.

  • NEAREST rounds to the nearest half: 5.1 is rounded to 5, and 3.5 is rounded to 4.

  • Also used in combination with quantityPerUnit. Rounds the number of units after quantityPerUnit is applied. If you set quantityPerUnit to a value other than one, you would typically set Rounding to UP. For example, suppose you charge by kilobytes per second (KiBy/s), set quantityPerUnit = 500, and set charge rate at $0.25 per unit used. If your customer used 48,900 KiBy/s in a billing period, the charge would be 48,900 / 500 = 97.8 rounded up to 98 * 0.25 = $2.45.

Available options:
UP,
DOWN,
NEAREST,
NONE
quantityPerUnit
number
required

Defines how much of a quantity equates to 1 unit. Used when setting the price per unit for billing purposes - if charging for kilobytes per second (KiBy/s) at rate of $0.25 per 500 KiBy/s, then set quantityPerUnit to 500 and price Plan at $0.25 per unit.

Note: If quantityPerUnit is set to a value other than one, rounding is typically set to "UP".

Required range: x > 0
unit
string
required

User defined label for units shown for Bill line items, indicating to your customers what they are being charged for.

Required string length: 1 - 50
calculation
string
required

String that represents the formula for the calculation. This formula determines how the Compound Aggregation value is calculated. The calculation can reference simple Aggregations or Custom Fields. This field is required when creating or updating a Compound Aggregation.

NOTE: If a simple Aggregation referenced by a Compound Aggregation has a Quantity per unit defined or a Rounding defined, these will not be factored into the value used by the calculation. For example, if the simple Aggregation referenced has a base value of 100 and has Quantity per unit set at 10, the Compound Aggregation calculation will use the base value of 100 not 10.

Required string length: 1 - 5000
version
integer<int64>
customFields
object

User defined fields enabling you to attach custom data. The value for a custom field can be either a string or a number.

If customFields can also be defined for this entity at the Organizational level, customField values defined at individual level override values of customFields with the same name defined at Organization level.

See Working with Custom Fields in the m3ter documentation for more information.

code
string

Code of the new Aggregation. A unique short code to identify the Aggregation.

Maximum string length: 80
Pattern: ^[\p{L}_$][\p{L}_$0-9]*$
Example:

"example_code"

accountingProductId
string

Optional Product ID this Aggregation should be attributed to for accounting purposes.

Required string length: 36
productId
string

Unique identifier (UUID) of the Product the Compound Aggregation belongs to.

Note: Omit this parameter if you want to create a Global Compound Aggregation.

Required string length: 36
evaluateNullAggregations
boolean

Boolean True / False flag:

  • TRUE Set to TRUE if you want to allow null values from the simple Aggregations referenced in the Compound Aggregation to be passed in. Simple Aggregations based on Meter Target Fields where no usage data is available will have null values.
  • FALSE Default.

Note: If any of the simple Aggregations you reference in a Compound Aggregation calculation might have null values, you must set their Default Value to 0. This ensures that any null values passed into the Compound Aggregation are passed in correctly with value = 0.

Response

Returns the created Compound Aggregation

id
string
required

The UUID of the entity.

version
integer<int64>

The version number:

  • Create: On initial Create to insert a new entity, the version is set at 1 in the response.
  • Update: On successful Update, the version is incremented by 1 in the response.
customFields
object

User defined fields enabling you to attach custom data. The value for a custom field can be either a string or a number.

If customFields can also be defined for this entity at the Organizational level,customField values defined at individual level override values of customFields with the same name defined at Organization level.

See Working with Custom Fields in the m3ter documentation for more information.

name
string

Descriptive name for the Aggregation.

rounding
enum<string>

Specifies how you want to deal with non-integer, fractional number Aggregation values.

NOTES:

  • NONE is default.
  • NEAREST rounds to the nearest half: 5.1 is rounded to 5, and 3.5 is rounded to 4.
  • Also used in combination with quantityPerUnit. Rounds the number of units after quantityPerUnit is applied. If you set quantityPerUnit to a value other than one, you would typically set Rounding to UP. For example, suppose you charge by kilobytes per second (KiBy/s), set quantityPerUnit = 500, and set charge rate at $0.25 per unit used. If your customer used 48,900 KiBy/s in a billing period, the charge would be 48,900 / 500 = 97.8 rounded up to 98 * 0.25 = $2.45.
Available options:
UP,
DOWN,
NEAREST,
NONE
quantityPerUnit
number

Defines how much of a quantity equates to 1 unit. Used when setting the price per unit for billing purposes - if charging for kilobytes per second (KiBy/s) at rate of $0.25 per 500 KiBy/s, then set quantityPerUnit to 500 and price Plan at $0.25 per unit.

If quantityPerUnit is set to a value other than one, rounding is typically set to UP.

unit
string

User defined or following the Unified Code for Units of Measure (UCUM).

Used as the label for billing, indicating to your customers what they are being charged for.

code
string

Code of the Aggregation. A unique short code to identify the Aggregation.

segments
object[]

(Optional). Used when creating a segmented Aggregation, which segments the usage data collected by a single Meter. Works together with segmentedFields.

Contains the values that are to be used as the segments, read from the fields in the meter pointed at by segmentedFields.

accountingProductId
string

Optional Product ID this Aggregation should be attributed to for accounting purposes.

calculation
string

This field is a string that represents the formula for the calculation. This formula determines how the Compound Aggregation is calculated from the underlying usage data.

productId
string

This field represents the unique identifier (UUID) of the Product that is associated with the Compound Aggregation.

evaluateNullAggregations
boolean

This is a boolean True / False flag.

If set to TRUE, the calculation will be evaluated even if the referenced aggregation has no usage data.

dtCreated
string<date-time>

The date and time (in ISO-8601 format) when the Compound Aggregation was created.

dtLastModified
string<date-time>

The date and time (in ISO-8601 format) when the Compound Aggregation was last modified.

createdBy
string

The unique identifier (UUID) of the user who created this Compound Aggregation.

lastModifiedBy
string

The unique identifier (UUID) of the user who last modified this Compound Aggregation.