geofence.history

The geofence.history command is used to find and return a list of historical geofence events.

TR50 Request

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

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

// Last number of records request
{
  "cmd": {
    "command": "geofence.history",
    "params": {
      "key": "mygeofence",
      "thingKey": "mything",
      "records": 100
    }
  }
}

Request Parameters

Name

Type

Required

Description

key

String

 

The key of the geofence.

thingKey

String

 

The key of the thing.

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

offset

Integer

 

The starting list offset, used for pagination. Defaults to 0 if not specified.

limit

Integer

 

Limit the number of results returned. Defaults to the configured maximum limit.

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": {
      "values": [
        {
          "id": "5537c620681fdc176a00298f",
          "thingId": "54dbcaac681fdc2760000510",
          "geofenceKey": "boca",
          "start": "2015-04-22T16:02:40.779Z",
          "end": "2015-04-22T16:03:19.33Z",
          "duration": 38
        },
        {
          "id": "5537c3e3681fdc176a0016c1",
          "thingId": "54dbcaac681fdc2760000510",
          "geofenceKey": "ils",
          "start": "2015-04-22T15:53:07.88Z",
          "end": "2015-04-22T15:58:49.75Z",
          "duration": 341
        },
        {
          "id": "5537c336681fdc176a001106",
          "thingId": "54dbcaac681fdc2760000510",
          "geofenceKey": "boca",
          "start": "2015-04-22T15:50:14.065Z",
          "end": "2015-04-22T16:01:01.782Z",
          "duration": 647
        }
      ]
    }
  }
}

Response Parameters

Name

Type

Description

values

Array

An array consisting of event objects.

Event Object

Name

Type

Description

id

String

A unique id for each record in the history.

thingId

String

The unique identifier of the Thing associated with the event.

geofenceKey

String

The key of the geofence associated with the event.

start

Timestamp

The timestamp associated with the "enter" event.

end

Timestamp

The timestamp associated with the "leave" event, only set once it the "leave" event occurs.

duration

Integer

The number of seconds that have elapsed between the "enter" and "leave" events.