location.summary

The location.summary command is used to generate a summary of time spent in each location by a specified thing over a period of time.

TR50 Request


                        // Definite time period request
{
  "cmd": {
    "command": "location.summary",
    "params": {
      "thingKey": "mything",
      "field": "state",
      "start": "2014-01-01T00:00:00Z",
      "end": "2014-01-31T23:59:59Z"
    }
  }
}

// Last period of time request
{
  "cmd": {
    "command": "location.summary",
    "params": {
      "thingKey": "mything",
      "field": "state",
      "last": "24h"
    }
  }
}
      

Request Parameters

Name

Type

Required

Description

 

Thing Identifier Parameters

 

Identifies the thing associated with the location entries. If omitted, the session's thingKey will be used. See Thing Identifier Parameters table below for supported parameters.

field

String

 

Identifies the location field to be used as the aggregation group. Accepted values are zipcode, city, state, or country.

start

String

 

When doing a definite time period request this is the timestamp for the start of the specified time window.

end

String

 

When doing a definite time period request this is the timestamp for the end of the specified time window.

last

String

 

When doing a last period of time request this specifies the last X amount of time in nanoseconds (ns), microseconds (us), milliseconds (ms), seconds (s), minutes (m) or hours (h).

Thing Identifier Parameters

Name

Type

Description

thingKey

String

Key of the thing

thingId

String

Id of the thing

esn

String

Esn of the thing

iccid

String

Iccid of the thing

imei

String

Imei of the thing

imsi

String

Imsi of the thing

meid

String

Meid of the thing

msisdn

String

Msisdn of the thing

TR50 Response

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


                        {
  "cmd": {
    "success": true,
    "params": {
      "fields" : [
        {"place": "FL", "duration": 2531393},
        {"place": "OH", "duration": 473}
      ]
    }
  }
}
      

Response Parameters

Name

Type

Description

fields

Array

 Array of field objects each containing a place identifier along with its duration total.

fields[].place

String

The place identifier. Varies according to the field parameter in the request: ZIP code, city name, state, or country.

fields[].duration

Integer

The aggregate time spent in that location (in seconds) for the requested period of time.