Unit Metric
Unit Metric resource.
Get a Unit Metric by identifier with records for the specified time range.
Account Identifier for the Entity.
Unit Metric identifier
Start time in ISO 8601 format (e.g., 2020-03-03T15:32:44Z or 2020-03-03T15:32:44%2B00:00)
End time in ISO 8601 format (e.g., 2020-03-03T15:32:44Z or 2020-03-03T15:32:44%2B00:00)
Groups unit metric samples into calendar buckets (DAY, WEEK, or MONTH) before applying the metric's default aggregation in BigQuery.
DAYPossible values: Bad Request
This is Failure entity as defied in Harness
Internal server error
Returns Unit Metric metadata and records for the specified time range
GET /gateway/ccm/api/unit-metric?accountIdentifier=text&metricIdentifier=text&startTime=text&endTime=text HTTP/1.1
Host: nextgen-ce-d788d786-ssnpc
Accept: */*
{
"status": "SUCCESS",
"code": "DEFAULT_ERROR_CODE",
"message": "text",
"correlationId": "text",
"errors": [
{
"fieldId": "text",
"error": "text"
}
]
}Create a Unit Metric.
Account Identifier for the Entity.
The request object for Unit Metric
Unique metric identifier for the unit metric
Display name of the unit metric
Unit Metric Description
Aggregation applied to unit cost metric values per time bucket in BigQuery. Supported: AVG (default when omitted or null), MIN, MAX, SUM.
Strategy for handling missing/empty data points in unit cost metrics. LEAVE_BLANK: leave missing points empty (default). PREVIOUS_VALUE: carry forward the last known value. ZERO: fill gaps with 0.
Discriminator for unit metric data source: manually uploaded time-series or derived dynamically from a BigQuery column.
Data source to query for COLUMN-type unit metrics. Each source declares its query backend (BigQuery or UDP), the physical table/entity to read, and the timestamp column used for time bucketing.
BigQuery column name to aggregate for DERIVED metrics. Required when type=DERIVED.
SQL aggregation function applied to the fieldId column.
Bad Request
This is Failure entity as defied in Harness
Internal server error
Returns a created Unit Metric Object
POST /gateway/ccm/api/unit-metric?accountIdentifier=text HTTP/1.1
Host: nextgen-ce-d788d786-ssnpc
Content-Type: application/json
Accept: */*
Content-Length: 300
{
"metricIdentifier": "text",
"metricName": "text",
"labels": {
"manager": "kiran"
},
"description": "text",
"defaultAggregation": "AVG",
"handleEmptyValue": "PREVIOUS_VALUE",
"unitMetricRecords": [
{
"value": 1,
"usageTimeStamp": "text"
}
],
"type": "MANUAL",
"dataSource": "BILLING",
"fieldId": "text",
"columnAggregation": "SUM"
}{
"status": "SUCCESS",
"code": "DEFAULT_ERROR_CODE",
"message": "text",
"correlationId": "text",
"errors": [
{
"fieldId": "text",
"error": "text"
}
]
}Update an existing Unit Metric.
Account Identifier for the Entity.
The request object for Unit Metric
Unique metric identifier for the unit metric
Display name of the unit metric
Unit Metric Description
Aggregation applied to unit cost metric values per time bucket in BigQuery. Supported: AVG (default when omitted or null), MIN, MAX, SUM.
Strategy for handling missing/empty data points in unit cost metrics. LEAVE_BLANK: leave missing points empty (default). PREVIOUS_VALUE: carry forward the last known value. ZERO: fill gaps with 0.
Discriminator for unit metric data source: manually uploaded time-series or derived dynamically from a BigQuery column.
Data source to query for COLUMN-type unit metrics. Each source declares its query backend (BigQuery or UDP), the physical table/entity to read, and the timestamp column used for time bucketing.
BigQuery column name to aggregate for DERIVED metrics. Required when type=DERIVED.
SQL aggregation function applied to the fieldId column.
Bad Request
This is Failure entity as defied in Harness
Internal server error
Returns an updated Unit Metric Object
PUT /gateway/ccm/api/unit-metric?accountIdentifier=text HTTP/1.1
Host: nextgen-ce-d788d786-ssnpc
Content-Type: application/json
Accept: */*
Content-Length: 300
{
"metricIdentifier": "text",
"metricName": "text",
"labels": {
"manager": "kiran"
},
"description": "text",
"defaultAggregation": "AVG",
"handleEmptyValue": "PREVIOUS_VALUE",
"unitMetricRecords": [
{
"value": 1,
"usageTimeStamp": "text"
}
],
"type": "MANUAL",
"dataSource": "BILLING",
"fieldId": "text",
"columnAggregation": "SUM"
}{
"status": "SUCCESS",
"code": "DEFAULT_ERROR_CODE",
"message": "text",
"correlationId": "text",
"errors": [
{
"fieldId": "text",
"error": "text"
}
]
}Delete Unit Metric records within a specified time range, or pass deleteCompleteMetric=true to remove the metric definition along with all of its records (startTime/endTime are ignored in that case). A complete delete is rejected when the metric is still referenced by any Perspective.
Account Identifier for the Entity.
Unit Metric identifier
Start time in ISO 8601 format (e.g., 2020-03-03T15:32:44Z or 2020-03-03T15:32:44%2B00:00). Required when deleteCompleteMetric=false; ignored otherwise.
End time in ISO 8601 format (e.g., 2020-03-03T15:32:44Z or 2020-03-03T15:32:44%2B00:00). Required when deleteCompleteMetric=false; ignored otherwise.
When true, deletes the entire Unit Metric (definition + all records) and ignores startTime/endTime. The deletion is rejected if the metric is referenced by any Perspective.
falseBad Request
This is Failure entity as defied in Harness
Internal server error
Returns success status
DELETE /gateway/ccm/api/unit-metric?accountIdentifier=text&identifier=text HTTP/1.1
Host: nextgen-ce-d788d786-ssnpc
Accept: */*
{
"status": "SUCCESS",
"code": "DEFAULT_ERROR_CODE",
"message": "text",
"correlationId": "text",
"errors": [
{
"fieldId": "text",
"error": "text"
}
]
}Query a DERIVED-type unit metric with perspective filters applied, optionally with additional filters on top of the perspective's saved rules.
Perspective ID whose filters will be applied
Account Identifier for the Entity.
DERIVED-type unit metric identifier
Start time in ISO 8601 format (e.g., 2020-03-03T15:32:44Z)
End time in ISO 8601 format (e.g., 2020-03-03T15:32:44Z)
Groups unit metric samples into calendar buckets (DAY, WEEK, or MONTH) before applying the metric's default aggregation in BigQuery.
DAYPossible values: When false (default), body filters are applied on top of the perspective's saved rules. When true, the perspective's saved rules are ignored and only the body filters are applied — used to preview an edited/removed filter set before saving.
falseGet Recommendations for a perspective
Bad Request
This is Failure entity as defied in Harness
Internal server error
Returns time-bucketed metric values with perspective filters applied
POST /gateway/ccm/api/unit-metric/perspective/{perspectiveId}?accountIdentifier=text&metricIdentifier=text&startTime=text&endTime=text HTTP/1.1
Host: nextgen-ce-d788d786-ssnpc
Content-Type: application/json
Accept: */*
Content-Length: 553
[
{
"idFilter": {
"field": {
"fieldId": "text",
"fieldName": "text",
"identifier": "CLUSTER",
"identifierName": "text"
},
"operator": "NOT_IN",
"values": [
"text"
]
},
"timeFilter": {
"field": {
"fieldId": "text",
"fieldName": "text",
"identifier": "CLUSTER",
"identifierName": "text"
},
"operator": "AFTER",
"value": 1
},
"timeRangeTypeFilter": "LAST_MONTH",
"viewMetadataFilter": {
"viewId": "text",
"isPreview": true,
"preview": true
},
"ruleFilter": {
"conditions": [
{
"field": {
"fieldId": "text",
"fieldName": "text",
"identifier": "CLUSTER",
"identifierName": "text"
},
"operator": "NOT_IN",
"values": [
"text"
]
}
]
}
}
]{
"status": "SUCCESS",
"code": "DEFAULT_ERROR_CODE",
"message": "text",
"correlationId": "text",
"errors": [
{
"fieldId": "text",
"error": "text"
}
]
}Get all Unit Metrics for an account (metadata only, no records).
Account Identifier for the Entity.
Number of unit metrics to be shown (max 100)
20Number of records to be skipped
0Search key to filter unit metrics by name (case-insensitive)
Sort field for the list
LAST_UPDATED_ATPossible values: Sort order (ASCENDING or DESCENDING)
Bad Request
This is Failure entity as defied in Harness
Internal server error
Returns a list of all Unit Metrics for the account
GET /gateway/ccm/api/unit-metric/list?accountIdentifier=text&pageSize=20&pageNo=0 HTTP/1.1
Host: nextgen-ce-d788d786-ssnpc
Accept: */*
{
"status": "SUCCESS",
"code": "DEFAULT_ERROR_CODE",
"message": "text",
"correlationId": "text",
"errors": [
{
"fieldId": "text",
"error": "text"
}
]
}Last updated
Was this helpful?