> ## Documentation Index
> Fetch the complete documentation index at: https://learn.servitly.com/llms.txt
> Use this file to discover all available pages before exploring further.
# Get metrics by thing-definition
> Returns the list of metrics of a specific thing-definition.
Metrics are the model used to manage data points published by the IoT connectors (measures, states, counters, BLOBs) or computed at runtime (i.e. insights).
Set includeInherited to true to obtain also the metrics inherited from the parent thing-definitions.
## OpenAPI
````json GET /inventory/thingDefinitions/{thingDefinitionId}/metrics
{
"openapi": "3.1.0",
"info": {
"title": "Servitly DPS API",
"version": "1.0.0"
},
"servers": [
{
"url": "https://api.servitly-sandbox.com",
"description": "[AWS SANDBOX]"
},
{
"url": "https://api.servitly.com",
"description": "[AWS PRODUCTION Ireland]"
},
{
"url": "https://api-ap.servitly.com",
"description": "[AWS Hong Kong]"
},
{
"url": "https://azapi.servitly-dev.com",
"description": "[AZURE DEV Frankfurt]"
},
{
"url": "https://azapi.servitly-staging.com",
"description": "[AZURE STAGING Frankfurt]"
},
{
"url": "https://azapi.servitly.com",
"description": "[AZURE PRODUCTION Frankfurt]"
}
],
"security": [
{
"bearerAuth": []
}
],
"tags": [
{
"name": "ACTIONS"
},
{
"name": "ALERTS"
},
{
"name": "API GATEWAY"
},
{
"name": "AUTHENTICATION"
},
{
"name": "AUTHORIZATIONS"
},
{
"name": "CUSTOMERS"
},
{
"name": "DATA IMPORT / EXPORT"
},
{
"name": "EVENTS"
},
{
"name": "LOCATIONS"
},
{
"name": "MAINTENANCE"
},
{
"name": "MAPPING"
},
{
"name": "METRIC DATA"
},
{
"name": "MOBILE APP"
},
{
"name": "ORGANIZATION"
},
{
"name": "PARTNERS"
},
{
"name": "PRODUCT MODELS"
},
{
"name": "SPARE PARTS"
},
{
"name": "STATISTICS"
},
{
"name": "STORE ORDERS"
},
{
"name": "SUBSCRIPTIONS"
},
{
"name": "SUBSCRIPTIONS (OLD)"
},
{
"name": "THING CONTROL"
},
{
"name": "THING DEFINITIONS"
},
{
"name": "THING MANAGEMENT"
},
{
"name": "THINGS"
},
{
"name": "TICKETS"
},
{
"name": "USER TYPES"
},
{
"name": "USERS"
},
{
"name": "WORK SESSIONS"
}
],
"paths": {
"/inventory/thingDefinitions/{thingDefinitionId}/metrics": {
"get": {
"summary": "Get metrics by thing-definition",
"description": "Returns the list of metrics of a specific thing-definition.
Metrics are the model used to manage data points published by the IoT connectors (measures, states, counters, BLOBs) or computed at runtime (i.e. insights).
Set includeInherited to true to obtain also the metrics inherited from the parent thing-definitions.",
"tags": [
"THING DEFINITIONS"
],
"parameters": [
{
"$ref": "#/components/parameters/tenantNameHeader"
},
{
"$ref": "#/components/parameters/includeInherited"
},
{
"in": "path",
"name": "thingDefinitionId",
"required": "true",
"schema": {
"$ref": "#/components/schemas/ObjectId"
},
"description": "The thing-definition identifier whose metrics must be retrieved."
}
],
"responses": {
"200": {
"description": "Successful operation.",
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/Metric"
}
}
}
}
},
"401": {
"$ref": "#/components/responses/NotAuthenticated"
},
"403": {
"$ref": "#/components/responses/NotAuthorized"
},
"404": {
"$ref": "#/components/responses/NotFound"
},
"429": {
"$ref": "#/components/responses/ApiLimit"
},
"500": {
"$ref": "#/components/responses/IntError"
}
}
}
}
},
"components": {
"parameters": {
"tenantNameHeader": {
"in": "header",
"name": "X-Servitly-Tenant",
"required": "true",
"schema": {
"type": "string",
"example": "{{tenantName}}"
},
"description": "The name of the tenant (e.g. acme)."
},
"includeInherited": {
"in": "query",
"name": "includeInherited",
"required": "false",
"schema": {
"type": "boolean"
},
"description": "If true, the response includes the elements inherited from parent thing definitions."
}
},
"schemas": {
"ObjectId": {
"type": "string",
"example": "abcd1234",
"minimum": "1",
"description": "The object identifier (e.g. 6620e4bb42541977c406b984)."
},
"Metric": {
"description": "The object describing a metric.",
"allOf": [
{
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "The metric object identifier.",
"readOnly": "true"
},
"name": {
"type": "string",
"description": "The metric name.",
"example": "temp"
},
"label": {
"type": "string",
"description": "The metric label.",
"example": "Temperature"
},
"description": {
"type": "string",
"description": "The metric description.",
"example": "The environment temperature measured through...."
},
"unit": {
"type": "string",
"description": "The metric measurement unit.",
"example": "°c"
},
"group": {
"type": "string",
"description": "The name of the group to which the metric belongs.",
"example": "Sensors"
},
"type": {
"type": "string",
"enum": [
"SIMPLE",
"BLOB",
"RECORD",
"COUNTER",
"DERIVED",
"DELTA",
"ALGORITHM",
"WEAR"
],
"description": "The metric type."
},
"valueType": {
"type": "string",
"description": "The metric value type.",
"enum": [
"STRING",
"BOOLEAN",
"INTEGER",
"LONG",
"FLOAT",
"DOUBLE"
]
},
"mapping": {
"type": "object",
"description": "The metric mapping (RAW Data metrics only).",
"properties": {
"path": {
"type": "string",
"description": "The metric mapping path.",
"example": "measures"
},
"name": {
"type": "string",
"description": "The metric mapping name.",
"example": "temp, hum, R50"
}
}
},
"thingDefinition": {
"writeOnly": "true",
"description": "The thing-definition identifier associated with the metric.",
"allOf": [
{
"$ref": "#/components/schemas/IdRef"
}
]
}
}
}
]
},
"IdRef": {
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "The referenced object identifier.",
"example": "1234abcd"
}
}
}
},
"responses": {
"NotAuthenticated": {
"description": "User not authenticated.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"message": {
"type": "string",
"description": "The error response.",
"example": "User not authenticated"
}
}
}
}
}
},
"NotAuthorized": {
"description": "User not authorized.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"message": {
"type": "string",
"description": "The error response.",
"example": "User not authorized"
}
}
}
}
}
},
"NotFound": {
"description": "Resource was not found.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"message": {
"type": "string",
"description": "The error response.",
"example": "Resource not found"
}
}
}
}
}
},
"ApiLimit": {
"description": "API call rate limit exceeded.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"message": {
"type": "string",
"description": "The error response.",
"example": "API call rate limit exceeded"
}
}
}
}
}
},
"IntError": {
"description": "Internal server error.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"message": {
"type": "string",
"description": "The error response.",
"example": "Internal Server Error"
}
}
}
}
}
}
},
"securitySchemes": {
"bearerAuth": {
"type": "http",
"scheme": "bearer"
}
}
}
}
````