geofence.summary

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

TR50 Request


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

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

Request Parameters

Name

Type

Required

Description

thingKey

String

 

Identifies the thing associated with the geofence events. If omitted, the session's thingKey will be used.

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).

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": {
      "geofences" : {
        "work": 408146,
        "home": 94632
      }
    }
  }
}
      

Response Parameters

Name

Type

Description

geofences

Object

Key-value pairs with the key being a geofence key and the value being the time spent in that geofence (in seconds).