usage.thing.history

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

Thing connectivity history can be requested by specifying either of the following:

  • a definite time period using a start and end date

  • a time period prior to the current time, for example, 24h, 180m, 113000s, 120d

TR50 Request

// Definite time period request
{
  "get": {
    "command": "usage.thing.history",
    "params": {
      "includeSubOrgs": false,
      "showAll": false,
      "start": "2014-03-26T00:00:00.000-00:00",
      "end": "2014-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

 

When doing a definite time period request, this is the timestamp for the start of the specified time window. Used together with end to define the time period.

end

String

 

When doing a definite time period request this is the timestamp for the end of the specified time window. Used together with start to define the time period.

series

String

 

How the data should be 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 are returned.

{
  "get": {
    "success": true,
    "params": {
      "connected": [0, 0, 0, 0, 1],
      "total": [1, 1, 1, 1, 1],
      "ts": [
        "2014-01-26T00:00:00-05:00",
        "2014-01-27T00:00:00-05:00",
        "2014-01-28T00:00:00-05:00",
        "2014-01-29T00:00:00-05:00",
        "2014-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.