usage.thing.history

The usage.thing.history command gets historical thing connectivity statistics.

Thing connectivity history is requested by specifying either:

  • A definite time period using a start and end date
  • To query on last few days or few hours or few minutes (For example, 24h, 180m, 113000s, 120d)

TR50 Request

// Definite time period request
{
  "get": {
    "command": "usage.thing.history",
    "params": {
      "includeSubOrgs": false,
      "showAll": false,
      "start": "2019-03-26T00:00:00.000-00:00",
      "end": "2019-03-30T00:00:00.000-00:00",
      "series": "day"
    }
  }
}
// Last period of time request
{
  "get": {
    "command": "usage.thing.history",
    "params": {
      "includeSubOrgs": false,
      "showAll": false,
      "last": "120h",
      "series": "day"
    }
  }
}

Request Parameters

Name Type Required Description
includeSubOrgs Boolean If sub-org totals should be included in the results.
showAll Boolean If all organizations should be included in the results. Requires Super-Ops.
last String Valid time units are seconds (s), minutes (m), hours (h), or days (d).
start String Timestamp.
end String Timestamp.
series String Enter the way the data needs to get aggregated. Valid options are "hour" and "day". Defaults to "hour".

TR50 Response

If the command is sent successfully a success message and the statistics are returned. Otherwise, an error and error message will be returned.

The number of records returned is limited to 5000 by the deviceWISE Cloud. If your query returns more results than the limit of the deviceWISE Cloud, you should shorten your time window or lower the number of records you are requesting.

{
  "get": {
    "success": true,
    "params": {
      "connected": [0, 0, 0, 0, 1],
      "total": [1, 1, 1, 1, 1],
      "ts": [
        "2019-01-26T00:00:00-05:00",
        "2019-01-27T00:00:00-05:00",
        "2019-01-28T00:00:00-05:00",
        "2019-01-29T00:00:00-05:00",
        "2019-01-30T00:00:00-05:00"
      ]
    }
  }
}

Response Parameters

Name Type Description
billable Array An array of the total number of billable things during the time period in the corresponding position in the ts array below.
connected Array An array of the total number of connected things during the time period in the corresponding position in the ts array below.
total Array An array of the total number of things during the time period in the corresponding position in the ts array below.
ts Array An array of the timestamps associated with the connected and total values.