Get metrics data

GET/projects/{projectId}/entities/{entityId}/metrics/{metricsDefinitionId}/data

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

Get the metrics data. 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 entries will be fetched from ts to tsEnd. Use the selectValues parameter to specify which value fields of the collection should be returned. When raw data entries are being fetched, it is possible to use the selectTags parameter to retrieve the tag fields from the entries as well.

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.
entityIdstringYesEntity ID (unique within project)
metricsDefinitionIdstringYesMetrics definition ID (unique within entity class)

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. When tsEnd is specified, the positive limit should have ts before tsEnd and the negative limit should have ts after tsEnd.
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 entries 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.
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"]]
endstringNoread-only (server-generated)The end time of data entries. The format follows RFC3339.
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",
  "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
    ]
  ],
  "end": "2020-01-29T01:26:08.101Z",
  "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.