Skip to content

Metric

Manage Metrics.

Fetch

Fetch device and service metrics from a device cloud.

Endpoint

HTTP
POST /metric/fetch

Authorized User Role

user

Request Body

FieldTypeRequiredNotes
itemsarrayyesArray of metric requests.

Item Object

FieldTypeRequiredDefaultNotes
accumulatebooleanAccumulate result into a single result.
cloudIdstringDevice Cloud ID.
dimensionsobjectDimensions for metric.
fieldstringDatabase model field name.
limitnumberNumber of items to fetch.
metricstringMetric name.
modelstringDatabase model name.
multiplebooleanMultiple dimensions requested.
namespacestringyesMust be set to Embedthis/Device.
periodnumber300Metric timespan period.
startnumberMetric range start.
statisticstringyesavgMetric statistic. Select from: avg, min, max, count, sum.

Response

Paged response.

FieldTypeNotes
dataarrayAn array of metrics each containing an array of metric with the following properties.
nextstringPaged cursor to use for the next page of items.
prevstringPages cursor to use for the previous page of items.

Metric

FieldTypeNotes
dimensionsobjectDimensions for the metric.
metricstringMetric name.
namespacestringAlways set to Embedthis/Device.
ownerstringThe service owning the metric.
periodnumberMetric timespan period.
pointsarrayArray of data points.
samplesnumberNumber of data points in the period.
*any

Dimensions

Dimensions for the metric.

FieldType
*any

Points

FieldTypeNotes
valuenumberMetric value.
timestampnumberLast update to the metric value in milli-seconds since Jan 1, 1970.
countnumberNumber of data values contributing to the metric value.

GetMetricList

Get a list of metrics available for a device cloud.

Endpoint

HTTP
POST /metric/getMetricList

Authorized User Role

user

Request Body

FieldType
cloudIdstring
namespacestring
metricstring

Response

Object Record.

FieldTypeNotes
namespacesarrayReturns the requested namespace. If not provided, returns a list of available namespaces.
metricsarrayIf a namespace is provided, returns a list of available metrics.
dimensionsarrayIf a namespace and metric are provided, returns a list of available metric dimensions.

GetDeviceSchema

Get the device data schema for a device cloud.

Endpoint

HTTP
POST /metric/getDeviceSchema

Authorized User Role

user

Request Body

FieldTypeNotes
cloudIdstringCloud ID.

Response

Device schema object.