Get metrics data for entity class

GET/projects/{projectId}/entityClasses/{entityClassId}/metrics/{metricsDefinitionId}/data

Base URL: https://api.tinkermode.com

Get the metrics data from the multiple entities with the specified entity class. Use the parentEntityId parameter to specify a parent entity. The result will contain metrics for all children entities that belong to the entity class. Use the begin and end parameters to fetch entries by time range, with the proper time resolution automatically applied. Use the ts and limit parameters to fetch a specific number of entries before or after a point in time. When the optional param tsEnd is provided, the data points will be fetched from ts to tsEnd. Use the selectValues parameter to specify which value fields of the collection should be returned. This endpoint is only available for TSDBv2 metrics. The user must have permission to read the metrics of the parent entity to access the data.

Authentication

Send an Authorization header of the form ModeCloud <AUTH_CODE>.

Must contain a user API key of a user with permission to read the entity metrics, a service account token with the same permission, or a project API key.

Path parameters

NameTypeRequiredConstraintsDescription
projectIdintegerYesThe unique ID for a specified project.
entityClassIdstringYesEntity Class ID (unique within project)
metricsDefinitionIdstringYesIdentifier of a metrics definition.

Query parameters

NameTypeRequiredConstraintsDescription
aggregationstringNoAggregation function. The string must be either 'avg', 'min', 'max', 'sum' or 'count'. 'avg' is chosen if not provided.
beginstringNoThe beginning time of the data entries. The format follows RFC3339.
endstringNoThe end time of the data entries. The format follows RFC3339.
limitintegerNoIf positive, this is the maximum number of data entries at and after ts to be returned. If negative, this is the maximum number of data points before ts to be returned.
parentEntityIdstringNoParent entity ID.
resolutionstringNoThe resolution of time bucket. The string must be either '5sec', '15sec', '1min', '10min', '1hour', '1day', '1week', '1month'. Decided automatically based on the timespan between "begin" and "end" parameters if not provided.
selectTagsstringNoA comma-delimited list of tag names. This is used only when fetching entries with the ts and limit parameters. If data entries contain tags, use this parameter to return the desired tag fields.
selectValuesstringYesA comma-delimited list of value names. Since each data entry in the collection contains multiple value fields, the fields to be returned must be specified
tsstringNoThe point in time (in RFC3339) to fetch data entries from.
tsEndstringNoThe point in time (in RFC3339) to fetch data points to.

Responses

200 The requested metrics data entries are returned.

Content type: application/json

PropertyTypeRequiredConstraintsDescription
aggregationstringNoread-only (server-generated); one of: avg, min, max, sum, countAggregation method used.
beginstringNoread-only (server-generated)The begin time of data entries. The format follows RFC3339.
endstringNoread-only (server-generated)The end time of data entries. The format follows RFC3339.
entitiesDataarray<object>Noread-only (server-generated)
Properties of entitiesData
PropertyTypeRequiredConstraintsDescription
dataarrayNoread-only (server-generated)Collection data. Each entry is an array as tuple and the first item is timestamp of the value in RFC3339 format, followed by the selected values and tags. e.g. [["2016-01-01T00:00:00Z", 1.0, 333, "foo"], ["2016-01-02T00:00:00Z", 2.0, 299, "bar"]]
entityIdstringNoread-only (server-generated)ID of the entity that owns the data
limitintegerNoread-only (server-generated)The maximum number of data entries to be fetched.
resolutionstringNoread-only (server-generated); one of: 1min, 10min, 1hour, 1day, 1week, 1monthAggregation bucket resolution. Its value depends on the time span of the query.
tsstringNoread-only (server-generated)The point in time (in RFC3339) from which data entries were fetched.

Response example

{
  "aggregation": "avg",
  "begin": "2019-04-11T07:51:46.712Z",
  "end": "2020-01-29T01:26:08.101Z",
  "entitiesData": [
    {
      "data": [
        [
          "2019-04-11T00:00:00Z",
          22.97349639133924,
          0.66,
          772
        ],
        [
          "2019-04-12T00:00:00Z",
          22.916217542079057,
          0.77,
          899
        ],
        [
          "2019-04-13T00:00:00Z",
          21.939217256214157,
          0.8,
          502
        ],
        [
          "2019-04-14T00:00:00Z",
          21.668999574649146,
          0.5,
          888
        ],
        [
          "2019-04-15T00:00:00Z",
          23.01144695453247,
          0.55,
          890
        ],
        [
          "2019-04-16T00:00:00Z",
          23.877712361878466,
          0.63,
          792
        ],
        [
          "2019-04-17T00:00:00Z",
          24.251540345449843,
          0.45,
          662
        ],
        [
          "2019-04-18T00:00:00Z",
          23.900341664030382,
          0.8,
          705
        ],
        [
          "2019-04-19T00:00:00Z",
          23.579976112920807,
          0.78,
          780
        ]
      ],
      "entityId": "entity1"
    },
    {
      "data": [
        [
          "2018-03-11T00:00:00Z",
          21.34734029348923,
          0.92,
          822
        ],
        [
          "2018-03-12T00:00:00Z",
          23.23498654839539,
          0.62,
          949
        ],
        [
          "2018-03-13T00:00:00Z",
          21.234986235762307,
          0.44,
          332
        ],
        [
          "2018-03-14T00:00:00Z",
          22.234254345323677,
          0.27,
          278
        ],
        [
          "2018-03-15T00:00:00Z",
          25.234782347234834,
          0.32,
          110
        ]
      ],
      "entityId": "entity2"
    }
  ],
  "resolution": "1day"
}

401 Authorization is required to access this resource.

Content type: application/json

PropertyTypeRequiredConstraintsDescription
dataobjectNoread-only (server-generated)Any relevant data related to error.
reasonstringYesread-only (server-generated)Reason of error.

403 Request failed because of denied permission.

Content type: application/json

PropertyTypeRequiredConstraintsDescription
dataobjectNoread-only (server-generated)Any relevant data related to error.
reasonstringYesread-only (server-generated)Reason of error.

404 The requested data does not exist or is not accessible.

Content type: application/json

PropertyTypeRequiredConstraintsDescription
dataobjectNoread-only (server-generated)Any relevant data related to error.
reasonstringYesread-only (server-generated)Reason of error.

429 Request failed because of rate limit.

Content type: application/json

PropertyTypeRequiredConstraintsDescription
dataobjectNoread-only (server-generated)Any relevant data related to error.
reasonstringYesread-only (server-generated)Reason of error.

500 An unexpected error has occurred.

Content type: application/json

PropertyTypeRequiredConstraintsDescription
dataobjectNoread-only (server-generated)Any relevant data related to error.
reasonstringYesread-only (server-generated)Reason of error.

503 The service is temporarily unavailable.

Content type: application/json

PropertyTypeRequiredConstraintsDescription
dataobjectNoread-only (server-generated)Any relevant data related to error.
reasonstringYesread-only (server-generated)Reason of error.