counter.count

The counter.count command is used to retrieve count records in the counter system.

TR50 Request

{
  "1": {
    "command": "counter.count",
    "params": {
      "type": "trigger.org.day",
      "field": "OrgId",
      "calc": "sum",
      "series": "day",
      "last": "30d",
      "limit": 8,
      "searchables": "560ef49c681fdc7d1f015605"
    }
  }
}

Request Parameters

Name

Type

Required

Description

type

String

 Yes

Counter types that can be searched. For more information about counter types, see counter.types.

field

String

 

Counter type fields that can be searched. Use for the list of fields that can be specified for a counter type. For more information about the field types, see counter.fields.

series

String

Yes

Series for calculating the data. Can be day, hour, 15min, 5min, or total.

calc

String

Yes

How to calculate the data. Can be sum, last, avg, or count.

orables

Array

 

Limit data by search in a logical OR fashion, for example, orgId1 OR orgId2. Fields can be searched in orables.

searchables

Array

 

Limit data by search in a logical AND fashion, for example, orgId1 AND orgId2. Fields can be searched in searchables. 

One of the following parameters is required.

start

String

Yes

When doing a definite time period request this is the timestamp for the start of the specified time window. Used together with the end parameter 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 the start parameter to define the time period.

last

String

 

When doing a last period of time request this specifies the last X amount of time in seconds (s), minutes (m), hours (h), or days (d).

records

Integer

 

When doing a last number of records request this specifies the number of records to return.

TR50 Response

If the command is sent successfully, a success message and the property value are returned. Otherwise, an error and error message are returned.

{
  "1": {
    "success": true,
    "params": {
      "534c36e53100460721000051": [
        6.21,
        4.583,
        6.012,
        3.65,
        4.126,
        5.793,
        7.55,
        6.428
      ],
      "queryTime": 13,
      "ts": [
        "2017-03-16T00:00:00Z",
        "2017-03-15T00:00:00Z",
        "2017-03-14T00:00:00Z",
        "2017-03-13T00:00:00Z",
        "2017-03-12T00:00:00Z",
        "2017-03-11T00:00:00Z",
        "2017-03-10T00:00:00Z",
        "2017-03-09T00:00:00Z"
      ]
    }
  }
}

Response Parameters

Name

Type

Description

params

Array

Array of data grouped by Field.

queryTime

Integer

Time it took to run the query in milliseconds.

ts

Array

Array of timestamps corresponding to params.