Segment Filters

Introduction to Segments

Segments are a set of location based rules. They are created using the Segment Filters API and then referenced by ID in the Segment Queries API to get lists of devices that match the segment or setup callbacks.

Filters are the building block of segments. A filter may look like the following:

Present in Region A between 14:00 21/02/2019 and 16:00 21/02/2019

Filters can then be combined in a Segment, where either all of the filters must be met or any of them can be met:

Any
Present in Region A between 14:00 21/02/2019 and 16:00 21/02/2019
Present in Region A between 14:00 22/02/2019 and 16:00 22/02/2019

There is no limit to the number of Filters than can part of a Segment. Segments can be created and then used in other segments:

Segment A

Any
Present in Region A between 14:00 21/02/2019 and 16:00 21/02/2019
Present in Region A between 14:00 22/02/2019 and 16:00 22/02/2019

Segment B

Any
Present in Region B between 14:00 21/02/2019 and 16:00 21/02/2019
Present in Region B between 14:00 22/02/2019 and 16:00 22/02/2019

Segment C

All
Segment A
Segment B

This Segment will be true for a device if it visits Region A on either the 21st or the 22nd and it visits Region B on either the 21st or the 22nd.

Filter Options

NameDescriptionOther Parameters
IN_NOWDevices that are currently in a regionregionId
OUT_NOWDevices that are currently not in a region. Must always be combined with an ‘IN’ type.regionId
IN_ATDevices that were in the region at the given timeregionId, atTime
OUT_ATDevices that were not in the region at the given time. Must always be combined with an ‘IN’ typeregionId, atTime
IN_BETWEENDevices that were in the region at some point between the two given timesregionId, from, to, minDwell (optional)
OUT_BETWEENDevices that were not in the region at any point between the two given timesregionId, from, to
ENTERED_BETWEENDevices that entered the region between the two given timesregionId, from, to
EXITED_BETWEENDevices that exited the region between the two given timesregionId, from, to
ENTEREDDevices that enter the region. This should only be used for triggered messages / callbacks.regionId
EXITEDDevices that exit the region. This should only be used for triggered messages / callbacks.regionId

Segment Properties

NameTypeDescription
idStringThe segment ID. This is not required (and will be ignored) on creation. It is used when updating segments.
nameStringThe name of the segment
segmentTypeStringThe type of segment, ANY or ALL (the docs reference IN_ORDER and NUMBER_OF but they are no longer supported)
filtersArray of FiltersThe filters that make up the segment
segmentIdsArray of StringsIDs of other segments being used as part of this segment
orderedIdsArray of StringsA list of the filter IDs and segment IDs
hiddenBooleanThis is used in the Colocator UI to hide / show segments in the list

Filter Properties

NameTypeDescription
idStringThe filter ID, must be generated as a gen 4 UUID
filterTypeStringOne of the filter types listed above
regionIdStringThe ID of the region being used
atTimeStringA timestamp for use with AT type filters
fromStringA timestamp for use with BETWEEN type filters
toStringA timestamp for use with BETWEEN type filters
minDwellStringA dwell time in milliseconds that the device has to be present. Only used with the IN_BETWEEN type.