Update metric

Updates an existing metric. To update a metric, first deactivate any associated decisions.

Header Parameters
PubNub-Version string REQUIRED

Possible values: [2026-02-09]

Request Body REQUIRED
name string REQUIRED

Possible values: 1 ≤ length ≤ 50

Metric name (1-50 characters).

id string

PubNub-generated unique ID for the metric. Required in later requests to update, delete, or retrieve the metric.

businessObjectId string REQUIRED

ID of the source business object.

measureId string

Field ID to aggregate (required for AVG, MAX, MIN, SUM functions). References a NUMERIC field from the business object.

evaluationWindow number REQUIRED

Possible values: 1 ≤ value ≤ 86400

Time period in seconds for metric evaluation. Allowed values: 60 (1 min), 300 (5 min), 600 (10 min), 900 (15 min), 1800 (30 min), 3600 (1 hour), 86400 (1 day).

function string REQUIRED

Possible values: [AVG, SUM, MAX, MIN, COUNT, COUNT_DISTINCT]

Aggregation function: AVG, COUNT, COUNT_DISTINCT, MAX, MIN, or SUM.

dimensionIds string[]

Field IDs to group by (TEXT fields only). References dimensions from the business object.

filters object[]

Filtering criteria for the metric.

id string

PubNub-generated ID for the metric filter. Required when updating a metric (PUT).

sourceType string REQUIRED

Possible values: [MEASURE, DIMENSION]

Filter source type. Value must always be DIMENSION.

sourceId string REQUIRED

ID of the field or data field to filter on.

operation string REQUIRED

Possible values: [NUMERIC_GREATER_THAN, NUMERIC_GREATER_THAN_EQUALS, NUMERIC_LESS_THAN, NUMERIC_LESS_THAN_EQUALS, NUMERIC_INCLUSIVE_BETWEEN, NUMERIC_EXCLUSIVE_NOT_BETWEEN, BOOLEAN_IS_TRUE, BOOLEAN_IS_FALSE, STRING_CONTAINS, STRING_NOT_CONTAINS, STRING_STARTS_WITH, STRING_ENDS_WITH, STRING_EQUALS, STRING_IS_EMPTY, STRING_IS_NOT_EMPTY, STRING_NOT_EQUALS]

Filter operation: STRING_EQUALS, STRING_NOT_EQUAL, STRING_CONTAINS, STRING_NOT_CONTAINS, STRING_IS_EMPTY, STRING_IS_NOT_EMPTY, STRING_STARTS_WITH, STRING_ENDS_WITH.

arguments string[] REQUIRED

Filter arguments (1 string). Matching is case-sensitive.

Responses
200
Schema OPTIONAL
id string

PubNub-generated unique ID for the metric. Required in later requests to update, delete, or retrieve the metric.

name string

Metric name (1-50 characters).

measureId string

Field ID to aggregate (required for AVG, MAX, MIN, SUM functions). References a NUMERIC field from the business object.

businessObjectId string

ID of the source business object.

evaluationWindow number OPTIONAL

Time period in seconds for metric evaluation. Allowed values: 60 (1 min), 300 (5 min), 600 (10 min), 900 (15 min), 1800 (30 min), 3600 (1 hour), 86400 (1 day).

function string

Aggregation function: AVG, COUNT, COUNT_DISTINCT, MAX, MIN, or SUM.

dimensionIds string[] OPTIONAL

Field IDs to group by (TEXT fields only). References dimensions from the business object.

dimensions object[] OPTIONAL

Information about the IDs included in the dimensionIds - the fields you grouped by.

id string

PubNub-generated unique ID for the field. Required when creating metrics and decisions. Used as measureId, dimensionIds, or inputFields[].sourceId.

name string

Field name (1-50 characters).

jsonPath string OPTIONAL

JSON path expression for extracting data (max 200 chars). Required when source is JSONPATH and isActive is true.

jsonFieldType string

Possible values: [TEXT, TEXT_LONG, NUMERIC, TIMESTAMP, DURATION_SECONDS]

Field data type: TEXT, TEXT_LONG (character limit is 1000, limited to 5 per Business Object), NUMERIC, or TIMESTAMP. Required when source is JSONPATH.

isKeyset boolean

Boolean flag indicating if this field is part of the keyset. Informational only.

source string

Possible values: [JSONPATH, DERIVED]

Field source type: JSONPATH or DERIVED.

derivation object OPTIONAL

Derivation configuration. Required when source is DERIVED.

operation string

Possible values: [TIME_DIFF]

Derivation operation type. Currently only TIME_DIFF is supported.

params object

Parameters for the derivation calculation.

startSource string

Possible values: [DATA_FIELD, PUBLISH_TIMETOKEN]

Start source for time difference calculation: DATA_FIELD or PUBLISH_TIMETOKEN. DATA_FIELD accepts only TIMESTAMP data type.

startFieldIndex number OPTIONAL

Index or position of the start timestamp data field in your array. Not required if startSource is PUBLISH_TIMETOKEN.

endSource string

Possible values: [DATA_FIELD, PUBLISH_TIMETOKEN]

End source for time difference calculation: DATA_FIELD or PUBLISH_TIMETOKEN.

endFieldIndex number OPTIONAL

Index or position of the end timestamp data field in your array. Not required if endSource is PUBLISH_TIMETOKEN.

filters object[] OPTIONAL

Filtering criteria for the metric.

id string

PubNub-generated ID for the metric filter. Required when updating a metric (PUT).

sourceType string

Possible values: [MEASURE, DIMENSION]

Filter source type. Value must always be DIMENSION.

sourceId string

ID of the field or data field to filter on.

operation string

Possible values: [NUMERIC_GREATER_THAN, NUMERIC_GREATER_THAN_EQUALS, NUMERIC_LESS_THAN, NUMERIC_LESS_THAN_EQUALS, NUMERIC_INCLUSIVE_BETWEEN, NUMERIC_EXCLUSIVE_NOT_BETWEEN, BOOLEAN_IS_TRUE, BOOLEAN_IS_FALSE, STRING_CONTAINS, STRING_NOT_CONTAINS, STRING_STARTS_WITH, STRING_ENDS_WITH, STRING_EQUALS, STRING_IS_EMPTY, STRING_IS_NOT_EMPTY, STRING_NOT_EQUALS]

Filter operation: STRING_EQUALS, STRING_NOT_EQUAL, STRING_CONTAINS, STRING_NOT_CONTAINS, STRING_IS_EMPTY, STRING_IS_NOT_EMPTY, STRING_STARTS_WITH, STRING_ENDS_WITH.

arguments string[]

Filter arguments (1 string). Matching is case-sensitive.

businessObject (circular) OPTIONAL

Optional nested object with details of the source Business Object.

404
* required
PubNub-Version*
Type: string
Possible values: [2026-02-09]
* required
name*
Type: string
Metric name (1-50 characters).
1-50 chars
id
Type: string
PubNub-generated unique ID for the metric. Required in later requests to update, delete, or retrieve the metric.
businessObjectId*
Type: string
ID of the source business object.
measureId
Type: string
Field ID to aggregate (required for AVG, MAX, MIN, SUM functions). References a NUMERIC field from the business object.
evaluationWindow*
Type: number
Time period in seconds for metric evaluation. Allowed values: 60 (1 min), 300 (5 min), 600 (10 min), 900 (15 min), 1800 (30 min), 3600 (1 hour), 86400 (1 day).
≥ 1, ≤ 86400
function*
Type: string
Aggregation function: AVG, COUNT, COUNT_DISTINCT, MAX, MIN, or SUM.
Enum (6 values)
View all values
"AVG""SUM""MAX""MIN""COUNT""COUNT_DISTINCT"
dimensionIds
Type: array
Field IDs to group by (TEXT fields only). References dimensions from the business object.
Array items:
items
Type: string
filters
Type: array
Filtering criteria for the metric.
Array items:
items
Type: object
id
Type: string
PubNub-generated unique ID for the metric. Required in later requests to update, delete, or retrieve the metric.
name
Type: string
Metric name (1-50 characters).
measureId
Type: string
Field ID to aggregate (required for AVG, MAX, MIN, SUM functions). References a NUMERIC field from the business object.
businessObjectId
Type: string
ID of the source business object.
evaluationWindow
Type: number
Time period in seconds for metric evaluation. Allowed values: 60 (1 min), 300 (5 min), 600 (10 min), 900 (15 min), 1800 (30 min), 3600 (1 hour), 86400 (1 day).
function
Type: string
Aggregation function: AVG, COUNT, COUNT_DISTINCT, MAX, MIN, or SUM.
dimensionIds
Type: array
Field IDs to group by (TEXT fields only). References dimensions from the business object.
Array items:
items
Type: string
dimensions
Type: array
Information about the IDs included in the dimensionIds - the fields you grouped by.
Array items:
items
Type: object
filters
Type: array
Filtering criteria for the metric.
Array items:
items
Type: object
businessObject
Type: any
Optional nested object with details of the source Business Object.