Loop API 0.3.4

This describes the resources for the Loop API. If you have any problems or requests contact support@bluecats.com.

New Features:

  • Events were added to the Schema endpoint so that there can be expected values

Table of Contents:

Introduction

The Loop API allows you to:

  • Create or update a single or multiple (batch) Groups or Objects
  • Change the password of the Group
  • Delete an Object
  • Claim or unclaim a single or multiple (batch) Objects by the Owner
  • Send batch Events
  • Search and perform analytics on Groups, Objects, and Events

Connecting to the API

Environment Connectivity PORT
Labs URL: https://bcstage.api.loop.bluecats.com/ 443 (default https port)
Production URL: {base_uri} 443 (default https port)

API Endpoints

This section contains outlines for API Endpoints and JSON structures with examples using cURL.

Login

Login credentials are returned after a POST request with your email and password in the body as JSON for user login. Basic Authorization Credentials is returned after a POST request for user login. Adding the Basic Authorization Credentials to your header allows you to make requests POST/GET groups.

HTTPS Element Request Details
method POST
header Content-Type: application/json, X-API-HEADER: 1
path {base_uri}/login
body { “email”: {email}, “password”: {password} }
Request

	curl \
	-H "Content-Type: application/json" \
	-H "X-API-HEADER: 1" \
	-X POST --data "@login.json" '{base_url}/login'
	
Response

	{
		"auth": "Basic {Authorization Token}",
		"groupID": {groupID}, 
		"email": "{email}",
		"firstName": "{firstName}", 
		"lastName": "{lastName}"
	}
	

Schema Query

Schema replaces the object-types endpoint. Performing a GET request on Schema is useful to determine which objects are available to which groups and which you can query. The group ID in the objectTypes shows what group created and has ownership of the objectType. Anyone underneath that group can create objects. When creating objects, check which object keys are required and what types they are when you want to create objects.

HTTPS Element Request Details
method GET
header Authorization: Basic {credentials}, Content-Type: application/json, X-API-HEADER: 1
path {base_uri}/schema

Schema Query Params

Key Value Required Explanation Example
incUIAttr bool No Exposes hidden UI Attributes within objectTypes incUIAttr=True
groupID string No String filters down objectTypes based on group access groupID={groupID}

Data Types

When you query the Schema endpoint, you can display types and key information for the resources for users, groups, objects, objectTypes. Everything stored in the database are these six data types.

Type Description Example
string length of string field that defaults to size 100 “firstName”
datetime ISO combined date in time for UTC format 2017-10-31T18:44:38.129120Z
decimal 9 digits on each side of the decimal point, if bigger than it will be truncated 34.2338
int 32-bits 56
json application/json format {“email”:{email}, “password”:{password}}
bool Only accepts True or False True

For each object type, it has a list of keys. Each key has a type, field, and attributes. The keys have attributes like being if it is required, if the type is editable, or if it has a linked to another object.

{
    "name": "groupID",
    "displayName": "Group ID",
    "required": true,
    "type": "string",
    "length": 32,
    "editable": true,
    "link": "groups"
}

Schema Field Descriptions

Schema Field Name Type Description
name string unique name of object type
displayName string non-unique name for use in displays
class Thing or Place class of object type
groupID string the id of the group this object type is defined for
keys list list of object keys and their parameters see key table below
uiAttr dictionary Dictionary of object keys and their ui parameters order of keys in the dictionary represents the order keys should be displayed in a list view see uiAttr Key table below

Key Field Descriptions

Key Field Name Type Description
name string Unique name of the key
displayName string Non-unique name for use in displays
required bool Whether the key value is required on creation or not
type string, json, datetime, int, decimal, or bool Type of the key’s value
length int Length of value (if type is string)
editable bool Whether the key value is able to be edited
link string If present, this represents that the key value is a reference to another object. The value of link is the object type name that this key is a reference to

UI Field Descriptions

uiAttr Key Field Name Type Description
hidden bool whether the key should be hidden or not in the list view
input string The input type that should be used for this key in forms. If input is not present, then value is assumed to be ‘textbox’. If the value is ‘special’ then the ui should already have special code in place for it.
detailsLink dictionary describes a URL to provide for more details pertaining to this key detailsLink dictionary example below

detailsLink dictionary example below:

{
	"path": ["/things", "objecttype", "objectid"],
	"queryParams": {
	     "showtab": "logs"
	}
}

In our example below, we will query the Schema endpoint. There are ellipses to shorten the very long schema response.

Request

	curl \
	-H "Authorization: Basic {Authorization Token}" \
	-H "Content-Type: application/json" \
	-H "X-API-HEADER: 1" \
	-X GET '{base_url}/schema?incUIAttr=True'
	
Response

			{
			    "groups": {
			        "keys": [
			            {
			                "name": "id",
			                "displayName": "ID",
			                "type": "string",
			                "length": 32,
			                "editable": false,
			                "required": false
			            },
			            {
			                "name": "type",
			                "displayName": "Type",
			                "type": "string",
			                "length": 100,
			                "editable": true,
			                "required": true
			            },
			            {
			                "name": "name",
			                "displayName": "Name",
			                "type": "string",
			                "length": 100,
			                "editable": true,
			                "required": true
			            },
			            {
			                "name": "parentID",
			                "displayName": "Parent Group",
			                "type": "string",
			                "length": 32,
			                "link": "groups",
			                "editable": true,
			                "required": true
			            },
			            {
			                "name": "dmanTeamID",
			                "displayName": "BlueCats Team ID",
			                "type": "string",
			                "length": 40,
			                "editable": false,
			                "required": false
			            },
			            {
			                "name": "abbreviation",
			                "displayName": "Abbreviation",
			                "type": "string",
			                "length": 100,
			                "editable": true,
			                "required": true
			            },
			            {
			                "name": "uiAttr",
			                "displayName": "UI Attributes",
			                "type": "json",
			                "editable": true,
			                "required": false
			            },
			            {
			                "name": "accountInfo",
			                "displayName": "Account Information",
			                "type": "json",
			                "editable": false,
			                "required": false
			            },
			            {
			                "name": "placeParentID",
			                "displayName": "Place Access Group",
			                "type": "string",
			                "length": 32,
			                "link": "groups",
			                "editable": true,
			                "required": false
			            }
			        ]
			    },
			    "users": {
			        "keys": [
			            {
			                "name": "email",
			                "displayName": "Email",
			                "type": "string",
			                "length": 100,
			                "editable": true,
			                "required": true
			            },
			            {
			                "name": "firstName",
			                "displayName": "First Name",
			                "type": "string",
			                "length": 100,
			                "editable": true,
			                "required": true
			            },
			            {
			                "name": "lastName",
			                "displayName": "Last Name",
			                "type": "string",
			                "length": 100,
			                "editable": true,
			                "required": true
			            },
			            {
			                "name": "groupID",
			                "displayName": "Group",
			                "type": "string",
			                "length": 100,
			                "link": "groups",
			                "editable": true,
			                "required": true
			            }
			        ]
			    },
			    "objectLinks": {
			        "keys": [
			            {
			                "name": "eventIDType",
			                "displayName": "Event ID Type",
			                "type": "string",
			                "length": 100
			            },
			            {
			                "name": "eventID",
			                "displayName": "Event ID",
			                "type": "string",
			                "length": 100
			            },
			            {
			                "name": "objectType",
			                "displayName": "Object Type",
			                "type": "string",
			                "length": 100
			            },
			            {
			                "name": "objectID",
			                "displayName": "Object ID",
			                "type": "string",
			                "length": 32
			            },
			            {
			                "name": "groupID",
			                "displayName": "Group ID",
			                "type": "string",
			                "length": 32,
			                "link": "groups"
			            }
			        ]
			    },
			    "objectTypes": [
			        "bcdEquipment",
			        "bcdParcel",
			        "bcdPerson",
			        "bcdTableFlag",
			        "bcdVehicle",
			        "Device",
			        "Place",
			    ],
			    "logTypes": [
			        "x_battlog",
			        "x_intransitlog",
			        "x_placelog",
			        "x_positionlog",
			        "x_statelog",
			        "x_templog",
			        "x_triplog"
			    ],
			    "objects": {
			        "bcdEquipment": {
			            "name": "bcdEquipment",
			            "displayName": "Equipment",
			            "class": "Thing",
			            "keys": [
			                {
			                    "name": "id",
			                    "displayName": "ID",
			                    "required": false,
			                    "type": "string",
			                    "length": 32,
			                    "editable": false
			                },
			                {
			                    "name": "groupID",
			                    "displayName": "Group ID",
			                    "required": true,
			                    "type": "string",
			                    "length": 32,
			                    "editable": true,
			                    "link": "groups"
			                },
			                {
			                    "name": "objectType",
			                    "displayName": "Object Type",
			                    "required": true,
			                    "type": "string",
			                    "length": 100,
			                    "editable": false,
			                    "populated": true
			                },
			                {
			                    "name": "type",
			                    "displayName": "Type",
			                    "required": true,
			                    "type": "string",
			                    "editable": true,
			                    "length": 100
			                },
			                {
			                    "name": "serialNumber",
			                    "displayName": "Serial Number",
			                    "required": false,
			                    "type": "string",
			                    "editable": true,
			                    "length": 100
			                },
			                {
			                    "name": "batterySoC",
			                    "displayName": "Battery %",
			                    "required": false,
			                    "type": "int",
			                    "editable": false,
			                    "timeCol": "batterySoCObservedAt"
			                },
			                {
			                    "name": "batterySoCObservedAt",
			                    "displayName": "Observed At",
			                    "required": false,
			                    "type": "datetime",
			                    "editable": false
			                },
			                {
			                    "name": "temp",
			                    "displayName": "Temp",
			                    "required": false,
			                    "type": "int",
			                    "editable": false,
			                    "length": 10,
			                    "timeCol": "tempObservedAt"
			                },
			                {
			                    "name": "tempObservedAt",
			                    "displayName": "Observed At",
			                    "required": false,
			                    "type": "datetime",
			                    "editable": false
			                },
			                {
			                    "name": "place",
			                    "displayName": "Place",
			                    "required": false,
			                    "type": "string",
			                    "editable": false,
			                    "length": 32,
			                    "link": "Place",
			                    "timeCol": "placeChangedAt"
			                },
			                {
			                    "name": "placeChangedAt",
			                    "displayName": "Changed At",
			                    "required": false,
			                    "type": "datetime",
			                    "editable": false
			                },
			                {
			                    "name": "long",
			                    "displayName": "Longitude",
			                    "required": false,
			                    "type": "decimal",
			                    "editable": false,
			                    "timeCol": "positionObservedAt"
			                },
			                {
			                    "name": "lat",
			                    "displayName": "Latitude",
			                    "required": false,
			                    "type": "decimal",
			                    "editable": false,
			                    "timeCol": "positionObservedAt"
			                },
			                {
			                    "name": "positionObservedAt",
			                    "displayName": "Observed At",
			                    "required": false,
			                    "type": "datetime",
			                    "editable": false
			                },
			                {
			                    "name": "mostRecentPlace",
			                    "displayName": "Most Recent Place",
			                    "required": false,
			                    "type": "string",
			                    "editable": false,
			                    "length": 32,
			                    "link": "Place",
			                    "timeCol": "mrPlaceChangedAt"
			                },
			                {
			                    "name": "mrPlaceChangedAt",
			                    "displayName": "Most Recent Place Changed At",
			                    "required": false,
			                    "type": "datetime",
			                    "editable": false
			                }
			            ],
			            "groupID": "a3cec63e2aa927c93567abd968677314"
			        },
			        "bcdParcel": {
			            "name": "bcdParcel",
			            "displayName": "Parcel",
			            "class": "Thing",
			            "keys": [
			                {
			                    "name": "id",
			                    "displayName": "ID",
			                    "required": false,
			                    "type": "string",
			                    "length": 32,
			                    "editable": false
			                },
			                {
			                    "name": "groupID",
			                    "displayName": "Group ID",
			                    "required": true,
			                    "type": "string",
			                    "length": 32,
			                    "editable": true,
			                    "link": "groups"
			                },
			                {
			                    "name": "objectType",
			                    "displayName": "Object Type",
			                    "required": true,
			                    "type": "string",
			                    "length": 100,
			                    "editable": false,
			                    "populated": true
			                },
			                {
			                    "name": "trackingNumber",
			                    "displayName": "Tracking #",
			                    "required": false,
			                    "type": "string",
			                    "editable": true,
			                    "length": 100
			                },
			                {
			                    "name": "condition",
			                    "displayName": "Condition",
			                    "required": false,
			                    "type": "string",
			                    "editable": true,
			                    "length": 100
			                },
			                {
			                    "name": "batterySoC",
			                    "displayName": "Battery %",
			                    "required": false,
			                    "type": "int",
			                    "editable": false,
			                    "timeCol": "batterySoCObservedAt"
			                },
			                {
			                    "name": "batterySoCObservedAt",
			                    "displayName": "Observed At",
			                    "required": false,
			                    "type": "datetime",
			                    "editable": false
			                },
			                {
			                    "name": "temp",
			                    "displayName": "Temp",
			                    "required": false,
			                    "type": "int",
			                    "editable": false,
			                    "length": 10,
			                    "timeCol": "tempObservedAt"
			                },
			                {
			                    "name": "tempObservedAt",
			                    "displayName": "Observed At",
			                    "required": false,
			                    "type": "datetime",
			                    "editable": false
			                },
			                {
			                    "name": "place",
			                    "displayName": "Place",
			                    "required": false,
			                    "type": "string",
			                    "editable": false,
			                    "length": 32,
			                    "link": "Place",
			                    "timeCol": "placeChangedAt"
			                },
			                {
			                    "name": "placeChangedAt",
			                    "displayName": "Changed At",
			                    "required": false,
			                    "type": "datetime",
			                    "editable": false
			                },
			                {
			                    "name": "mostRecentPlace",
			                    "displayName": "Most Recent Place",
			                    "required": false,
			                    "type": "string",
			                    "editable": false,
			                    "length": 32,
			                    "link": "Place",
			                    "timeCol": "mrPlaceChangedAt"
			                },
			                {
			                    "name": "mrPlaceChangedAt",
			                    "displayName": "Most Recent Place Changed At",
			                    "required": false,
			                    "type": "datetime",
			                    "editable": false
			                },
			                {
			                    "name": "long",
			                    "displayName": "Longitude",
			                    "required": false,
			                    "type": "decimal",
			                    "editable": false,
			                    "timeCol": "positionObservedAt"
			                },
			                {
			                    "name": "lat",
			                    "displayName": "Latitude",
			                    "required": false,
			                    "type": "decimal",
			                    "editable": false,
			                    "timeCol": "positionObservedAt"
			                },
			                {
			                    "name": "positionObservedAt",
			                    "displayName": "Observed At",
			                    "required": false,
			                    "type": "datetime",
			                    "editable": false
			                }
			            ],
			            "groupID": "a3cec63e2aa927c93567abd968677314"
			        },
			        "bcdPerson": {
			            "name": "bcdPerson",
			            "displayName": "Person",
			            "class": "Thing",
			            "keys": [
			                {
			                    "name": "id",
			                    "displayName": "ID",
			                    "required": false,
			                    "type": "string",
			                    "length": 32,
			                    "editable": false
			                },
			                {
			                    "name": "groupID",
			                    "displayName": "Group ID",
			                    "required": true,
			                    "type": "string",
			                    "length": 32,
			                    "editable": true,
			                    "link": "groups"
			                },
			                {
			                    "name": "objectType",
			                    "displayName": "Object Type",
			                    "required": true,
			                    "type": "string",
			                    "length": 100,
			                    "editable": false,
			                    "populated": true
			                },
			                {
			                    "name": "name",
			                    "displayName": "Name",
			                    "required": true,
			                    "type": "string",
			                    "editable": true,
			                    "length": 100
			                },
			                {
			                    "name": "serialNumber",
			                    "displayName": "Serial Number",
			                    "required": false,
			                    "type": "string",
			                    "editable": true,
			                    "length": 100
			                },
			                {
			                    "name": "batterySoC",
			                    "displayName": "Battery %",
			                    "required": false,
			                    "type": "int",
			                    "editable": false,
			                    "timeCol": "batterySoCObservedAt"
			                },
			                {
			                    "name": "batterySoCObservedAt",
			                    "displayName": "Observed At",
			                    "required": false,
			                    "type": "datetime",
			                    "editable": false
			                },
			                {
			                    "name": "temp",
			                    "displayName": "Temp",
			                    "required": false,
			                    "type": "int",
			                    "editable": false,
			                    "length": 10,
			                    "timeCol": "tempObservedAt"
			                },
			                {
			                    "name": "tempObservedAt",
			                    "displayName": "Observed At",
			                    "required": false,
			                    "type": "datetime",
			                    "editable": false
			                },
			                {
			                    "name": "place",
			                    "displayName": "Place",
			                    "required": false,
			                    "type": "string",
			                    "editable": false,
			                    "length": 32,
			                    "link": "Place",
			                    "timeCol": "placeChangedAt"
			                },
			                {
			                    "name": "placeChangedAt",
			                    "displayName": "Place Changed At",
			                    "required": false,
			                    "type": "datetime",
			                    "editable": false
			                },
			                {
			                    "name": "mostRecentPlace",
			                    "displayName": "Most Recent Place",
			                    "required": false,
			                    "type": "string",
			                    "editable": false,
			                    "length": 32,
			                    "link": "Place",
			                    "timeCol": "mrPlaceChangedAt"
			                },
			                {
			                    "name": "mrPlaceChangedAt",
			                    "displayName": "Most Recent Place Changed At",
			                    "required": false,
			                    "type": "datetime",
			                    "editable": false
			                },
			                {
			                    "name": "long",
			                    "displayName": "Longitude",
			                    "required": false,
			                    "type": "decimal",
			                    "editable": false,
			                    "timeCol": "positionObservedAt"
			                },
			                {
			                    "name": "lat",
			                    "displayName": "Latitude",
			                    "required": false,
			                    "type": "decimal",
			                    "editable": false,
			                    "timeCol": "positionObservedAt"
			                },
			                {
			                    "name": "positionObservedAt",
			                    "displayName": "Position Observed At",
			                    "required": false,
			                    "type": "datetime",
			                    "editable": false
			                },
			                {
			                    "name": "onsite",
			                    "displayName": "Onsite",
			                    "required": false,
			                    "type": "bool",
			                    "editable": false,
			                    "timeCol": "onsiteChangedAt"
			                },
			                {
			                    "name": "onsiteChangedAt",
			                    "displayName": "Onsite Changed At",
			                    "required": false,
			                    "type": "datetime",
			                    "editable": false
			                }
			            ],
			            "groupID": "a3cec63e2aa927c93567abd968677314"
			        },
			        "bcdTableFlag": {
			            "name": "bcdTableFlag",
			            "displayName": "Table Flag",
			            "class": "Thing",
			            "keys": [
			                {
			                    "name": "id",
			                    "displayName": "ID",
			                    "required": false,
			                    "type": "string",
			                    "length": 32,
			                    "editable": false
			                },
			                {
			                    "name": "groupID",
			                    "displayName": "Group ID",
			                    "required": true,
			                    "type": "string",
			                    "length": 32,
			                    "editable": true,
			                    "link": "groups"
			                },
			                {
			                    "name": "objectType",
			                    "displayName": "Object Type",
			                    "required": true,
			                    "type": "string",
			                    "length": 100,
			                    "editable": false,
			                    "populated": true
			                },
			                {
			                    "name": "flagNumber",
			                    "displayName": "Flag #",
			                    "required": false,
			                    "type": "string",
			                    "editable": true,
			                    "length": 100
			                },
			                {
			                    "name": "batterySoC",
			                    "displayName": "Battery %",
			                    "required": false,
			                    "type": "int",
			                    "editable": false,
			                    "timeCol": "batterySoCObservedAt"
			                },
			                {
			                    "name": "batterySoCObservedAt",
			                    "displayName": "Observed At",
			                    "required": false,
			                    "type": "datetime",
			                    "editable": false
			                },
			                {
			                    "name": "temp",
			                    "displayName": "Temp",
			                    "required": false,
			                    "type": "int",
			                    "editable": false,
			                    "length": 10,
			                    "timeCol": "tempObservedAt"
			                },
			                {
			                    "name": "tempObservedAt",
			                    "displayName": "Observed At",
			                    "required": false,
			                    "type": "datetime",
			                    "editable": false
			                },
			                {
			                    "name": "place",
			                    "displayName": "Place",
			                    "required": false,
			                    "type": "string",
			                    "editable": false,
			                    "length": 32,
			                    "link": "Place",
			                    "timeCol": "placeChangedAt"
			                },
			                {
			                    "name": "placeChangedAt",
			                    "displayName": "Changed At",
			                    "required": false,
			                    "type": "datetime",
			                    "editable": false
			                },
			                {
			                    "name": "long",
			                    "displayName": "Longitude",
			                    "required": false,
			                    "type": "decimal",
			                    "editable": false,
			                    "timeCol": "positionObservedAt"
			                },
			                {
			                    "name": "lat",
			                    "displayName": "Latitude",
			                    "required": false,
			                    "type": "decimal",
			                    "editable": false,
			                    "timeCol": "positionObservedAt"
			                },
			                {
			                    "name": "positionObservedAt",
			                    "displayName": "Observed At",
			                    "required": false,
			                    "type": "datetime",
			                    "editable": false
			                }
			            ],
			            "groupID": "a3cec63e2aa927c93567abd968677314"
			        },
			        "bcdVehicle": {
			            "name": "bcdVehicle",
			            "displayName": "Vehicle",
			            "class": "Thing",
			            "keys": [
			                {
			                    "name": "id",
			                    "displayName": "ID",
			                    "required": false,
			                    "type": "string",
			                    "length": 32,
			                    "editable": false
			                },
			                {
			                    "name": "groupID",
			                    "displayName": "Group ID",
			                    "required": true,
			                    "type": "string",
			                    "length": 32,
			                    "editable": true,
			                    "link": "groups"
			                },
			                {
			                    "name": "objectType",
			                    "displayName": "Object Type",
			                    "required": true,
			                    "type": "string",
			                    "length": 100,
			                    "editable": false,
			                    "populated": true
			                },
			                {
			                    "name": "type",
			                    "displayName": "Type",
			                    "required": true,
			                    "type": "string",
			                    "editable": true,
			                    "length": 100
			                },
			                {
			                    "name": "make",
			                    "displayName": "Make",
			                    "required": true,
			                    "type": "string",
			                    "editable": true,
			                    "length": 100
			                },
			                {
			                    "name": "model",
			                    "displayName": "Model",
			                    "required": true,
			                    "type": "string",
			                    "editable": true,
			                    "length": 100
			                },
			                {
			                    "name": "VIN",
			                    "displayName": "VIN",
			                    "required": false,
			                    "type": "string",
			                    "editable": true,
			                    "length": 100
			                },
			                {
			                    "name": "licensePlateNumber",
			                    "displayName": "License Plate #",
			                    "required": false,
			                    "type": "string",
			                    "editable": true,
			                    "length": 100
			                },
			                {
			                    "name": "year",
			                    "displayName": "Year",
			                    "required": false,
			                    "type": "string",
			                    "editable": true,
			                    "length": 100
			                },
			                {
			                    "name": "color",
			                    "displayName": "Color",
			                    "required": false,
			                    "type": "string",
			                    "editable": true,
			                    "length": 100
			                },
			                {
			                    "name": "owner",
			                    "displayName": "Owner",
			                    "required": false,
			                    "type": "string",
			                    "editable": true,
			                    "length": 100
			                },
			                {
			                    "name": "batterySoC",
			                    "displayName": "Battery %",
			                    "required": false,
			                    "type": "int",
			                    "editable": false,
			                    "timeCol": "batterySoCObservedAt"
			                },
			                {
			                    "name": "batterySoCObservedAt",
			                    "displayName": "Observed At",
			                    "required": false,
			                    "type": "datetime",
			                    "editable": false
			                },
			                {
			                    "name": "temp",
			                    "displayName": "Temp",
			                    "required": false,
			                    "type": "int",
			                    "editable": false,
			                    "length": 10,
			                    "timeCol": "tempObservedAt"
			                },
			                {
			                    "name": "tempObservedAt",
			                    "displayName": "Observed At",
			                    "required": false,
			                    "type": "datetime",
			                    "editable": false
			                },
			                {
			                    "name": "place",
			                    "displayName": "Place",
			                    "required": false,
			                    "type": "string",
			                    "editable": false,
			                    "length": 32,
			                    "link": "Place",
			                    "timeCol": "placeChangedAt"
			                },
			                {
			                    "name": "placeChangedAt",
			                    "displayName": "Changed At",
			                    "required": false,
			                    "type": "datetime",
			                    "editable": false
			                },
			                {
			                    "name": "long",
			                    "displayName": "Longitude",
			                    "required": false,
			                    "type": "decimal",
			                    "editable": false,
			                    "timeCol": "positionObservedAt"
			                },
			                {
			                    "name": "lat",
			                    "displayName": "Latitude",
			                    "required": false,
			                    "type": "decimal",
			                    "editable": false,
			                    "timeCol": "positionObservedAt"
			                },
			                {
			                    "name": "positionObservedAt",
			                    "displayName": "Observed At",
			                    "required": false,
			                    "type": "datetime",
			                    "editable": false
			                }
			            ],
			            "groupID": "a3cec63e2aa927c93567abd968677314"
			        },
			        "Device": {
			            "name": "Device",
			            "displayName": "Device",
			            "class": "Thing",
			            "keys": [
			                {
			                    "name": "id",
			                    "displayName": "ID",
			                    "required": false,
			                    "type": "string",
			                    "length": 32,
			                    "editable": false
			                },
			                {
			                    "name": "groupID",
			                    "displayName": "Group ID",
			                    "required": true,
			                    "type": "string",
			                    "length": 32,
			                    "editable": true,
			                    "link": "groups"
			                },
			                {
			                    "name": "objectType",
			                    "displayName": "Object Type",
			                    "required": true,
			                    "type": "string",
			                    "length": 100,
			                    "editable": false,
			                    "populated": true
			                },
			                {
			                    "name": "name",
			                    "displayName": "Name",
			                    "required": false,
			                    "type": "string",
			                    "editable": true,
			                    "length": 30
			                },
			                {
			                    "name": "serialNumber",
			                    "displayName": "Serial #",
			                    "required": false,
			                    "type": "string",
			                    "editable": true,
			                    "length": 50
			                },
			                {
			                    "name": "mac",
			                    "displayName": "MAC",
			                    "required": false,
			                    "type": "string",
			                    "editable": true,
			                    "length": 12
			                },
			                {
			                    "name": "modelNumber",
			                    "displayName": "Model #",
			                    "required": false,
			                    "type": "string",
			                    "editable": true,
			                    "length": 30
			                },
			                {
			                    "name": "deviceType",
			                    "displayName": "Type",
			                    "required": false,
			                    "type": "string",
			                    "editable": true,
			                    "length": 100
			                },
			                {
			                    "name": "wireframeUrl",
			                    "displayName": "Wireframe Url",
			                    "required": false,
			                    "type": "string",
			                    "editable": true,
			                    "length": 100
			                },
			                {
			                    "name": "place",
			                    "displayName": "Place",
			                    "required": false,
			                    "type": "string",
			                    "editable": true,
			                    "length": 32,
			                    "link": "Place"
			                },
			                {
			                    "name": "long",
			                    "displayName": "Longitude",
			                    "required": false,
			                    "type": "decimal",
			                    "editable": false,
			                    "timeCol": "positionObservedAt"
			                },
			                {
			                    "name": "lat",
			                    "displayName": "Latitude",
			                    "required": false,
			                    "type": "decimal",
			                    "editable": false,
			                    "timeCol": "positionObservedAt"
			                },
			                {
			                    "name": "positionObservedAt",
			                    "displayName": "Observed At",
			                    "required": false,
			                    "type": "datetime",
			                    "editable": false
			                },
			                {
			                    "name": "online",
			                    "displayName": "Online",
			                    "required": false,
			                    "type": "bool",
			                    "editable": false,
			                    "timeCol": "healthReportedAt"
			                },
			                {
			                    "name": "healthReportedAt",
			                    "displayName": "Health Reported At",
			                    "required": false,
			                    "type": "datetime",
			                    "editable": false
			                },
			                {
			                    "name": "carrier",
			                    "displayName": "Carrier",
			                    "required": false,
			                    "type": "string",
			                    "editable": true
			                },
			                {
			                    "name": "imei",
			                    "displayName": "IMEI",
			                    "required": false,
			                    "type": "string",
			                    "editable": true
			                },
			                {
			                    "name": "phoneNumber",
			                    "displayName": "Phone Number",
			                    "required": false,
			                    "type": "string",
			                    "editable": true
			                },
			                {
			                    "name": "battV",
			                    "displayName": "Battery Voltage",
			                    "required": false,
			                    "type": "int",
			                    "editable": false,
			                    "timeCol": "battVObservedAt"
			                },
			                {
			                    "name": "battVObservedAt",
			                    "displayName": "Battery Voltage Observed At",
			                    "required": false,
			                    "type": "datetime",
			                    "editable": false
			                },
			                {
			                    "name": "battI",
			                    "displayName": "Battery Current",
			                    "required": false,
			                    "type": "int",
			                    "editable": false,
			                    "timeCol": "battIObservedAt"
			                },
			                {
			                    "name": "battIObservedAt",
			                    "displayName": "Battery Current Observed At",
			                    "required": false,
			                    "type": "datetime",
			                    "editable": false
			                }
			            ],
			            "groupID": "764166c0c49c4e113c62f0ca3cecd84e"
			        },
			        "Place": {
			            "name": "Place",
			            "displayName": "Place",
			            "class": "Place",
			            "keys": [
			                {
			                    "name": "id",
			                    "displayName": "ID",
			                    "required": false,
			                    "type": "string",
			                    "length": 32,
			                    "editable": false
			                },
			                {
			                    "name": "groupID",
			                    "displayName": "Group ID",
			                    "required": true,
			                    "type": "string",
			                    "length": 32,
			                    "editable": true,
			                    "link": "groups"
			                },
			                {
			                    "name": "objectType",
			                    "displayName": "Object Type",
			                    "required": true,
			                    "type": "string",
			                    "length": 100,
			                    "editable": false,
			                    "populated": true
			                },
			                {
			                    "name": "name",
			                    "displayName": "Name",
			                    "required": true,
			                    "type": "string",
			                    "editable": true,
			                    "length": 30
			                },
			                {
			                    "name": "placeType",
			                    "displayName": "Type",
			                    "required": false,
			                    "type": "string",
			                    "editable": true,
			                    "length": 30
			                },
			                {
			                    "name": "fullName",
			                    "displayName": "Full Name",
			                    "required": false,
			                    "type": "string",
			                    "editable": true,
			                    "length": 100
			                },
			                {
			                    "name": "countryCode",
			                    "displayName": "Country Code",
			                    "required": false,
			                    "type": "string",
			                    "editable": true,
			                    "length": 4
			                },
			                {
			                    "name": "adminCode",
			                    "displayName": "State/Province Code",
			                    "required": false,
			                    "type": "string",
			                    "editable": true,
			                    "length": 4
			                },
			                {
			                    "name": "city",
			                    "displayName": "City",
			                    "required": false,
			                    "type": "string",
			                    "editable": true,
			                    "length": 58
			                },
			                {
			                    "name": "postalCode",
			                    "displayName": "Postal Code",
			                    "required": false,
			                    "type": "string",
			                    "editable": true,
			                    "length": 10
			                },
			                {
			                    "name": "street",
			                    "displayName": "Street",
			                    "required": false,
			                    "type": "string",
			                    "editable": true,
			                    "length": 100
			                },
			                {
			                    "name": "boundingBox",
			                    "displayName": "Bounding Box",
			                    "required": false,
			                    "type": "json",
			                    "editable": true
			                },
			                {
			                    "name": "attributes",
			                    "displayName": "Attributes",
			                    "required": false,
			                    "type": "json",
			                    "editable": true
			                },
			                {
			                    "name": "lat",
			                    "displayName": "Latitude",
			                    "required": false,
			                    "type": "decimal",
			                    "editable": true
			                },
			                {
			                    "name": "long",
			                    "displayName": "Longitude",
			                    "required": false,
			                    "type": "decimal",
			                    "editable": true
			                },
			                {
			                    "name": "zones",
			                    "displayName": "Zones",
			                    "required": false,
			                    "type": "json",
			                    "editable": false
			                },
			                {
			                    "name": "parentPlace",
			                    "displayName": "Parent Place",
			                    "required": false,
			                    "type": "string",
			                    "editable": true,
			                    "length": 32,
			                    "link": "Place"
			                },
			                {
			                    "name": "setObjectPosition",
			                    "displayName": "Set Object Position",
			                    "required": false,
			                    "type": "bool",
			                    "editable": false
			                }
			            ],
			            "groupID": "764166c0c49c4e113c62f0ca3cecd84e"
			        }
			    },
			    "logs": {
			        "x_battlog": {
			            "name": "x_battlog",
			            "displayName": "Battery Logs",
			            "groupID": "764166c0c49c4e113c62f0ca3cecd84e",
			            "keys": [
			                {
			                    "name": "ts",
			                    "displayName": "Timestamp",
			                    "type": "datetime"
			                },
			                {
			                    "name": "objectid",
			                    "displayName": "Object ID",
			                    "type": "string",
			                    "length": 32
			                },
			                {
			                    "name": "objecttype",
			                    "displayName": "Object Type",
			                    "type": "string",
			                    "length": 100
			                },
			                {
			                    "name": "groupid",
			                    "displayName": "Group ID",
			                    "type": "string",
			                    "length": 32
			                },
			                {
			                    "name": "max",
			                    "displayName": "MAX",
			                    "type": "int"
			                },
			                {
			                    "name": "min",
			                    "displayName": "MIN",
			                    "type": "int"
			                },
			                {
			                    "name": "avg",
			                    "displayName": "AVG",
			                    "type": "int"
			                }
			            ]
			        },
			        "x_intransitlog": {
			            "name": "x_intransitlog",
			            "displayName": "In Transit Logs",
			            "groupID": "764166c0c49c4e113c62f0ca3cecd84e",
			            "keys": [
			                {
			                    "name": "lastts",
			                    "displayName": "Last Timestamp",
			                    "type": "datetime"
			                },
			                {
			                    "name": "lastplacets",
			                    "displayName": "Last Place Timestamp",
			                    "type": "datetime"
			                },
			                {
			                    "name": "objectid",
			                    "displayName": "Object ID",
			                    "type": "string",
			                    "length": 32
			                },
			                {
			                    "name": "objecttype",
			                    "displayName": "Object Type",
			                    "type": "string",
			                    "length": 100
			                },
			                {
			                    "name": "groupid",
			                    "displayName": "Group ID",
			                    "type": "string",
			                    "length": 32
			                },
			                {
			                    "name": "lastplaceid",
			                    "displayName": "Last Place ID",
			                    "type": "string",
			                    "length": 32
			                },
			                {
			                    "name": "lastplace",
			                    "displayName": "Last Place",
			                    "type": "json"
			                },
			                {
			                    "name": "lastplacetype",
			                    "displayName": "Last Place Type",
			                    "type": "string",
			                    "length": 100
			                }
			            ]
			        },
			        "x_placelog": {
			            "name": "x_placelog",
			            "displayName": "Place Logs",
			            "groupID": "764166c0c49c4e113c62f0ca3cecd84e",
			            "keys": [
			                {
			                    "name": "ts",
			                    "displayName": "Timestamp",
			                    "type": "datetime"
			                },
			                {
			                    "name": "objectid",
			                    "displayName": "Object ID",
			                    "type": "string",
			                    "length": 32
			                },
			                {
			                    "name": "objecttype",
			                    "displayName": "Object Type",
			                    "type": "string",
			                    "length": 100
			                },
			                {
			                    "name": "groupid",
			                    "displayName": "Group ID",
			                    "type": "string",
			                    "length": 32
			                },
			                {
			                    "name": "placeid",
			                    "displayName": "Place ID",
			                    "type": "string",
			                    "length": 32
			                },
			                {
			                    "name": "place",
			                    "displayName": "Place",
			                    "type": "json"
			                },
			                {
			                    "name": "placetype",
			                    "displayName": "Place Type",
			                    "type": "string",
			                    "length": 100
			                },
			                {
			                    "name": "arrivalts",
			                    "displayName": "Arrival Time",
			                    "type": "datetime"
			                }
			            ]
			        },
			        "x_positionlog": {
			            "name": "x_positionlog",
			            "displayName": "Position Logs",
			            "groupID": "764166c0c49c4e113c62f0ca3cecd84e",
			            "keys": [
			                {
			                    "name": "ts",
			                    "displayName": "Timestamp",
			                    "type": "datetime"
			                },
			                {
			                    "name": "objectid",
			                    "displayName": "Object ID",
			                    "type": "string",
			                    "length": 32
			                },
			                {
			                    "name": "objecttype",
			                    "displayName": "Object Type",
			                    "type": "string",
			                    "length": 100
			                },
			                {
			                    "name": "groupid",
			                    "displayName": "Group ID",
			                    "type": "string",
			                    "length": 32
			                },
			                {
			                    "name": "lat",
			                    "displayName": "Latitude",
			                    "type": "decimal"
			                },
			                {
			                    "name": "long",
			                    "displayName": "Longitute",
			                    "type": "decimal"
			                },
			                {
			                    "name": "alt",
			                    "displayName": "Altitude",
			                    "type": "decimal"
			                }
			            ]
			        },
			        "x_statelog": {
			            "name": "x_statelog",
			            "displayName": "State Logs",
			            "groupID": "764166c0c49c4e113c62f0ca3cecd84e",
			            "keys": [
			                {
			                    "name": "id",
			                    "displayName": "ID",
			                    "type": "int"
			                },
			                {
			                    "name": "ts",
			                    "displayName": "Timestamp",
			                    "type": "datetime"
			                },
			                {
			                    "name": "objectid",
			                    "displayName": "Object ID",
			                    "type": "string",
			                    "length": 32
			                },
			                {
			                    "name": "objecttype",
			                    "displayName": "Object Type",
			                    "type": "string",
			                    "length": 100
			                },
			                {
			                    "name": "groupid",
			                    "displayName": "Group ID",
			                    "type": "string",
			                    "length": 32
			                },
			                {
			                    "name": "key",
			                    "displayName": "Key",
			                    "type": "string",
			                    "length": 100
			                },
			                {
			                    "name": "val_str",
			                    "displayName": "String Value",
			                    "type": "string",
			                    "length": 255
			                },
			                {
			                    "name": "val_int",
			                    "displayName": "Int Value",
			                    "type": "int"
			                },
			                {
			                    "name": "val_float",
			                    "displayName": "Decimal Value",
			                    "type": "decimal"
			                },
			                {
			                    "name": "val_bool",
			                    "displayName": "Boolean Value",
			                    "type": "bool"
			                },
			                {
			                    "name": "linkeddata",
			                    "displayName": "Linked Object Data",
			                    "type": "json"
			                },
			                {
			                    "name": "duration",
			                    "displayName": "Duration",
			                    "type": "int"
			                },
			            ]
			        },
			        
			        "x_templog": {
			            "name": "x_templog",
			            "displayName": "Temperature Logs",
			            "groupID": "764166c0c49c4e113c62f0ca3cecd84e",
			            "keys": [
			                {
			                    "name": "ts",
			                    "displayName": "Timestamp",
			                    "type": "datetime"
			                },
			                {
			                    "name": "objectid",
			                    "displayName": "Object ID",
			                    "type": "string",
			                    "length": 32
			                },
			                {
			                    "name": "objecttype",
			                    "displayName": "Object Type",
			                    "type": "string",
			                    "length": 100
			                },
			                {
			                    "name": "groupid",
			                    "displayName": "Group ID",
			                    "type": "string",
			                    "length": 32
			                },
			                {
			                    "name": "max",
			                    "displayName": "MAX",
			                    "type": "int"
			                },
			                {
			                    "name": "min",
			                    "displayName": "MIN",
			                    "type": "int"
			                },
			                {
			                    "name": "avg",
			                    "displayName": "AVG",
			                    "type": "int"
			                }
			            ]
			        },
			        "x_triplog": {
			            "name": "x_triplog",
			            "displayName": "Trip Logs",
			            "groupID": "979a3ef98cfb4ba37fd4cae28fea597",
			            "keys": [
			                {
			                    "name": "ts",
			                    "displayName": "Timestamp",
			                    "type": "datetime"
			                },
			                {
			                    "name": "objectid",
			                    "displayName": "Object ID",
			                    "type": "string",
			                    "length": 32
			                },
			                {
			                    "name": "objecttype",
			                    "displayName": "Object Type",
			                    "type": "string",
			                    "length": 100
			                },
			                {
			                    "name": "groupid",
			                    "displayName": "Group ID",
			                    "type": "string",
			                    "length": 32
			                },
			                {
			                    "name": "originid",
			                    "displayName": "Origin ID",
			                    "type": "string",
			                    "length": 32
			                },
			                {
			                    "name": "origin",
			                    "displayName": "Origin",
			                    "type": "json"
			                },
			                {
			                    "name": "departurets",
			                    "displayName": "Departure Time",
			                    "type": "datetime"
			                },
			                {
			                    "name": "destinationid",
			                    "displayName": "Destination ID",
			                    "type": "string",
			                    "length": 32
			                },
			                {
			                    "name": "destination",
			                    "displayName": "Destination",
			                    "type": "json"
			                },
			                {
			                    "name": "arrivalts",
			                    "displayName": "Arrival Time",
			                    "type": "datetime"
			                }
			            ]
			        }
			    },
			    "eventStructure": {
			        "keys": [
			            {
			                "name": "ts",
			                "displayName": "Timestamp",
			                "type": "datetime"
			            },
			            {
			                "name": "eventType",
			                "displayName": "Event Type",
			                "type": "string",
			                "length": 100
			            },
			            {
			                "name": "objectType",
			                "displayName": "Object Type",
			                "type": "string",
			                "length": 100
			            },
			            {
			                "name": "objectID",
			                "displayName": "Object ID",
			                "type": "string",
			                "length": 100
			            },
			            {
			                "name": "groupID",
			                "displayName": "Group ID",
			                "type": "string",
			                "length": 100,
			                "link": "groups"
			            },
			            {
			                "name": "edgeMAC",
			                "displayName": "Edge MAC",
			                "type": "string",
			                "length": 100
			            },
			            {
			                "name": "eventBody",
			                "displayName": "Event Body",
			                "type": "json"
			            },
			            {
			                "name": "deviceInfo",
			                "displayName": "Event Device Info",
			                "type": "json"
			            }
			        ]
			    },
			    "eventBodies": [
			        {
			            "name": "battI",
			            "displayName": "Battery Current",
			            "keys": [
			                {
			                    "name": "avg",
			                    "displayName": "Average",
			                    "type": "int"
			                },
			                {
			                    "name": "sum",
			                    "displayName": "Sum",
			                    "type": "int"
			                },
			                {
			                    "name": "min",
			                    "displayName": "Minimum",
			                    "type": "int"
			                },
			                {
			                    "name": "max",
			                    "displayName": "Maximum",
			                    "type": "int"
			                },
			                {
			                    "name": "count",
			                    "displayName": "Count",
			                    "type": "int"
			                }
			            ]
			        },
			        {
			            "name": "battSoC",
			            "displayName": "Battery Percentage",
			            "keys": [
			                {
			                    "name": "avg",
			                    "displayName": "Average",
			                    "type": "int"
			                },
			                {
			                    "name": "sum",
			                    "displayName": "Sum",
			                    "type": "int"
			                },
			                {
			                    "name": "min",
			                    "displayName": "Minimum",
			                    "type": "int"
			                },
			                {
			                    "name": "max",
			                    "displayName": "Maximum",
			                    "type": "int"
			                },
			                {
			                    "name": "count",
			                    "displayName": "Count",
			                    "type": "int"
			                }
			            ]
			        },
			        {
			            "name": "battV",
			            "displayName": "Battery Voltage",
			            "keys": [
			                {
			                    "name": "avg",
			                    "displayName": "Average",
			                    "type": "int"
			                },
			                {
			                    "name": "sum",
			                    "displayName": "Sum",
			                    "type": "int"
			                },
			                {
			                    "name": "min",
			                    "displayName": "Minimum",
			                    "type": "int"
			                },
			                {
			                    "name": "max",
			                    "displayName": "Maximum",
			                    "type": "int"
			                },
			                {
			                    "name": "count",
			                    "displayName": "Count",
			                    "type": "int"
			                }
			            ]
			        },
			        {
			            "name": "bleRSSI",
			            "displayName": "BLE RSSI",
			            "keys": [
			                {
			                    "name": "mac",
			                    "displayName": "Device MAC",
			                    "type": "string",
			                    "length": 100
			                },
			                {
			                    "name": "mPow",
			                    "displayName": "Measured Power",
			                    "type": "int"
			                },
			                {
			                    "name": "rssi",
			                    "displayName": "RSSI",
			                    "type": "int"
			                },
			                {
			                    "name": "rssiSmooth",
			                    "displayName": "Maximum",
			                    "type": "int"
			                },
			                {
			                    "name": "gps",
			                    "displayName": "GPS Location",
			                    "type": "json"
			                },
			                {
			                    "name": "pBatt",
			                    "displayName": "Battery Percentage",
			                    "type": "int"
			                },
			                {
			                    "name": "temp",
			                    "displayName": "Temperature",
			                    "type": "decimal"
			                },
			                {
			                    "name": "accX",
			                    "displayName": "Acceleration X",
			                    "type": "decimal"
			                },
			                {
			                    "name": "accY",
			                    "displayName": "Acceleration Y",
			                    "type": "decimal"
			                },
			                {
			                    "name": "measMsk",
			                    "displayName": "Measurem",
			                    "type": "decimal"
			                }
			            ]
			        },
			        {
			            "name": "chgCtrlHB",
			            "displayName": "Charge Controller Heartbeat",
			            "keys": [
			                {
			                    "name": "i",
			                    "displayName": "Current",
			                    "type": "int"
			                },
			                {
			                    "name": "v",
			                    "displayName": "Voltage",
			                    "type": "int"
			                },
			                {
			                    "name": "il",
			                    "displayName": "Current Load",
			                    "type": "int"
			                },
			                {
			                    "name": "cs",
			                    "displayName": "Charge Controller State",
			                    "type": "int"
			                },
			                {
			                    "name": "ppv",
			                    "displayName": "Panel Power",
			                    "type": "int"
			                },
			                {
			                    "name": "vpv",
			                    "displayName": "Panel Voltage",
			                    "type": "int"
			                },
			                {
			                    "name": "err",
			                    "displayName": "Error Code",
			                    "type": "int"
			                },
			                {
			                    "name": "fw",
			                    "displayName": "Firmware Version",
			                    "type": "int"
			                }
			            ]
			        },
			        {
			            "name": "edgeHB",
			            "displayName": "Edge Heartbeat",
			            "keys": [
			                {
			                    "name": "fwVer",
			                    "displayName": "Firmware Version",
			                    "type": "string",
			                    "length": 100
			                },
			                {
			                    "name": "fwUID",
			                    "displayName": "Firmware UID",
			                    "type": "string",
			                    "length": 100
			                },
			                {
			                    "name": "uptime",
			                    "displayName": "Uptime",
			                    "type": "int",
			                    "length": 100
			                },
			                {
			                    "name": "interfaces",
			                    "displayName": "Interfaces",
			                    "type": "json"
			                },
			                {
			                    "name": "defaultIP",
			                    "displayName": "Default IP",
			                    "type": "string",
			                    "length": 100
			                },
			                {
			                    "name": "fram",
			                    "displayName": "Free RAM",
			                    "type": "int"
			                }
			            ]
			        },
			        {
			            "name": "edgeLoc",
			            "displayName": "Edge Location",
			            "keys": [
			                {
			                    "name": "lat",
			                    "displayName": "Latitude",
			                    "type": "decimal"
			                },
			                {
			                    "name": "long",
			                    "displayName": "Longitude",
			                    "type": "decimal"
			                }
			            ]
			        },
			        {
			            "name": "enZone",
			            "displayName": "Enter Zone",
			            "keys": [
			                {
			                    "name": "enZone",
			                    "displayName": "Zone",
			                    "type": "string",
			                    "length": 100
			                }
			            ]
			        },
			        {
			            "name": "exZone",
			            "displayName": "Exit Zone",
			            "keys": [
			                {
			                    "name": "exZone",
			                    "displayName": "Zone",
			                    "type": "string",
			                    "length": 100
			                }
			            ]
			        },
			        {
			            "name": "offline",
			            "displayName": "Offline",
			            "keys": []
			        },
			        {
			            "name": "place",
			            "displayName": "Place",
			            "keys": [
			                {
			                    "name": "id",
			                    "displayName": "Place ID",
			                    "type": "string",
			                    "length": 32,
			                    "link": "Place"
			                }
			            ]
			        },
			        {
			            "name": "scanEvent",
			            "displayName": "Scan Event",
			            "keys": [
			                {
			                    "name": "mac",
			                    "displayName": "Device MAC",
			                    "type": "string",
			                    "length": 100
			                },
			                {
			                    "name": "mPow",
			                    "displayName": "Measured Power",
			                    "type": "int"
			                },
			                {
			                    "name": "rssi",
			                    "displayName": "RSSI",
			                    "type": "int"
			                },
			                {
			                    "name": "rssiSmooth",
			                    "displayName": "Maximum",
			                    "type": "int"
			                },
			                {
			                    "name": "lat",
			                    "displayName": "Latitude",
			                    "type": "decimal"
			                },
			                {
			                    "name": "long",
			                    "displayName": "Longitude",
			                    "type": "decimal"
			                },
			                {
			                    "name": "pBatt",
			                    "displayName": "Battery Percentage",
			                    "type": "int"
			                },
			                {
			                    "name": "temp",
			                    "displayName": "Temperature",
			                    "type": "decimal"
			                },
			                {
			                    "name": "accX",
			                    "displayName": "Acceleration X",
			                    "type": "decimal"
			                },
			                {
			                    "name": "accY",
			                    "displayName": "Acceleration Y",
			                    "type": "decimal"
			                },
			                {
			                    "name": "measMsk",
			                    "displayName": "Measurem",
			                    "type": "decimal"
			                }
			            ]
			        },
			        {
			            "name": "temp",
			            "displayName": "Temperature",
			            "keys": [
			                {
			                    "name": "avg",
			                    "displayName": "Average",
			                    "type": "int"
			                },
			                {
			                    "name": "sum",
			                    "displayName": "Sum",
			                    "type": "int"
			                },
			                {
			                    "name": "min",
			                    "displayName": "Minimum",
			                    "type": "int"
			                },
			                {
			                    "name": "max",
			                    "displayName": "Maximum",
			                    "type": "int"
			                },
			                {
			                    "name": "count",
			                    "displayName": "Count",
			                    "type": "int"
			                }
			            ]
			        }
			    ],
			    "eventTypes": [
			        "battI",
			        "battSoC",
			        "battV",
			        "bleRSSI",
			        "chgCtrlHB",
			        "edgeHB",
			        "edgeLoc",
			        "enZone",
			        "exZone",
			        "offline",
			        "place",
			        "scanEvent",
			        "temp"
			    ]
			}
	
	

Objects

Are what allow you to give what you want to track meaningful data and link it to Loop.

Create Objects

In order to Create Objects, you will POST to the Objects endpoint. To create objects, you will POST body JSON with:

  • objectType in body
  • groupID
  • required keys
  • and all of the optional keys.

Creating Object ID

During object creation, the Loop API will now accept a 32 character hex string in the ‘id’ field which will then be used as the object’s id.

HTTPS Element Request Details
method POST
header Authorization: Basic {credentials}, Content-Type: application/json, X-API-HEADER: 1
path (req) {base_uri}/objects
body { “groupID”: {groupID}, “objectType”: {objectType}, “requiredKey”: {requiredValue}, “optionalKey”: {optionalValue} }
Request

	curl \
	-H "Authorization: Basic {Authorization Token}" \
	-H "Content-Type: application/json" \
	-X POST --data "@object.json" 'https://bcstage.api.loop.bluecats.com/objects'
	

Object create and edit response returns a json dictionary with objectType and id.

Response

	"objectType": "Device", 
	"id": "4b3890e4fb580c6e9443b6081d0a1628"
	

Edit Objects

In order to Edit Objects, you will PATCH to the Objects endpoint. To edit objects, you will PATCH body JSON with:

  • objectID and object type in the body
  • any keys you want to change
  • You can change -> groupID if it is in your groups
HTTPS Element Request Details
method PATCH
header Authorization: Basic {credentials}, Content-Type: application/json, X-API-HEADER: 1
path (req) {base_uri}/objects
body { “id”: {id}, “objectType”: {objectType}, “editableKey”: {editableValue} }
Request

	curl \
	-H "Authorization: Basic {Authorization Token}" \
	-H "Content-Type: application/json" \
	-X PATCH --data "@object.json" '{base_url}/objects'
	

Object create and edit response returns a json dictionary with objectType and id.

Response

	"objectType": "Device", 
	"id": "4b3890e4fb580c6e9443b6081d0a1628"
	

Delete Objects

In order to delete Objects, you will DELETE to the Objects endpoint. To edit objects, you will DELETE body JSON with:

  • objectType
  • ID
HTTPS Element Request Details
method DELETE
header Authorization: Basic {credentials}, Content-Type: application/json
path (req) {base_uri}/objects
body { “id”: {id}, “objectType”: {objectType}}
Request

	curl \
	-H "Authorization: Basic {Authorization Token}" \
	-H "Content-Type: application/json" \
	-X DELETE --data "@object.json" '{base_url}/objects'
	
Response

	"objectType": "Device", 
	"id": "4b3890e4fb580c6e9443b6081d0a1628"
	

Object Links are what allow you to report events for a specific object to the Loop API. Each object can have multiple object links or event identifiers to report back to Loop. With object links, you can:

  • create
  • edit
  • delete

Note: All eventIDs will be returned lowercase. You are able to post it in any case format, but it will store it as lowercase.

Adds new object links, single or multiple, potentially for different objects and types.

HTTPS Element Request Details
method POST
header Authorization: Basic {credentials}, Content-Type: application/json, X-API-HEADER: 1
path (req) {base_uri}/objects/link
body [[objectType, objectID, eventIDType, eventID], [objectType2, objectID2, eventIDType2, eventID2]]
Request

	curl \
	-H "Authorization: Basic {Authorization Token}" \
	-H "Content-Type: application/json" \
	-H "X-API-HEADER: 1" \
	-X POST --data "@objectslink.json" '{base_url}/objects/link'
	
Response

	"Success"
	

Replaces object links on single object with PUT links.

HTTPS Element Request Details
method PUT
header Authorization: Basic {credentials}, Content-Type: application/json, X-API-HEADER: 1
path (req) {base_uri}/objects/link
body {objectType: val, objectID: val, links: [[eventIDType, eventID], [eventIDType2, eventID2]]}
Request

	curl \
	-H "Authorization: Basic {Authorization Token}" \
	-H "Content-Type: application/json" \
	-H "X-API-HEADER: 1" \
	-X PUT --data "@objectslink.json" '{base_url}/objects/link'
	
	
Response

	"Success"
	

Removes object links, single or multiple, potentially for different objects and types

HTTPS Element Request Details
method DELETE
header Authorization: Basic {credentials}, Content-Type: application/json, X-API-HEADER: 1
path (req) {base_uri}/objects/link
body [[objectType, objectID, eventIDType, eventID], [objectType2, objectID2, eventIDType2, eventID2]]
Request

	curl \
	-H "Authorization: Basic {Authorization Token}" \
	-H "Content-Type: application/json" \
	-H "X-API-HEADER: 1" \
	-X DELETE --data "@objectlink.json" '{base_url}/objects/link'
	
	
Response

	"Success"
	

Groups and Users

Only users in the root BlueCats group can use these endpoints. Works similar to object POST & PATCH. Relies on schema for users and groups. For users, ‘email’ is required on both POST & PATCH as it serves as the id. In order to create Users or Groups , you will POST to the users or groups endpoint. To create Users, you will POST body JSON with:

User Schema

	
		"users": {
	       "keys": [
	            {
	                "name": "email",
	                "displayName": "Email",
	                "type": "string",
	                "length": 100,
	                "editable": true,
	                "required": true
	            },
	            {
	                "name": "firstName",
	                "displayName": "First Name",
	                "type": "string",
	                "length": 100,
	                "editable": true,
	                "required": true
	            },
	            {
	                "name": "lastName",
	                "displayName": "Last Name",
	                "type": "string",
	                "length": 100,
	                "editable": true,
	                "required": true
	            },
	            {
	                "name": "groupID",
	                "displayName": "Group",
	                "type": "string",
	                "length": 100,
	                "link": "groups",
	                "editable": true,
	                "required": true
	            }
	        ]
    	}
	
	
Groups Schema

		"groups": {
		        "keys": [
		            {
		                "name": "id",
		                "displayName": "ID",
		                "type": "string",
		                "length": 32,
		                "editable": false,
		                "required": false
		            },
		            {
		                "name": "type",
		                "displayName": "Type",
		                "type": "string",
		                "length": 100,
		                "editable": true,
		                "required": true
		            },
		            {
		                "name": "name",
		                "displayName": "Name",
		                "type": "string",
		                "length": 100,
		                "editable": true,
		                "required": true
		            },
		            {
		                "name": "parentID",
		                "displayName": "Parent Group",
		                "type": "string",
		                "length": 32,
		                "link": "groups",
		                "editable": true,
		                "required": true
		            },
		            {
		                "name": "dmanTeamID",
		                "displayName": "BlueCats Team ID",
		                "type": "string",
		                "length": 40,
		                "editable": false,
		                "required": false
		            },
		            {
		                "name": "abbreviation",
		                "displayName": "Abbreviation",
		                "type": "string",
		                "length": 100,
		                "editable": true,
		                "required": true
		            },
		            {
		                "name": "uiAttr",
		                "displayName": "UI Attributes",
		                "type": "json",
		                "editable": true,
		                "required": false
		            },
		            {
		                "name": "accountInfo",
		                "displayName": "Account Information",
		                "type": "json",
		                "editable": false,
		                "required": false
		            },
		            {
		                "name": "placeParentID",
		                "displayName": "Place Access Group",
		                "type": "string",
		                "length": 32,
		                "link": "groups",
		                "editable": true,
		                "required": false
		            }
		        ]
		    }    
    	
HTTPS Element Request Details
method POST or PATCH
header Authorization: Basic {credentials}, Content-Type: application/json, X-API-HEADER: 1
path (req) {base_uri}/users or {base_uri}/groups
body {body}
Request

	curl \
	-H "Authorization: Basic {Authorization Token}" \
	-H "Content-Type: application/json" \
	-X PATCH --data "@user.json" '{base_url}/objects'
	

User create and edit response returns a json dictionary.

Events

Query Events

Login credentials are returned after a GET request for user login. Any event type located here. Those event types will be saved. However, it will not necessarily have state logic applied to it.

HTTPS Element Request Details
method GET
header Authorization: Basic {credentials}, Content-Type: application/json, X-API-HEADER: 1
path {base_uri}/events

Event Query Params

Key Value Required Explanation Examples
objectType string Yes specifying identifier to query objectType={objectType}
objectID string Yes specifying identifier to query objectID={objectID}
eventType string No event types eventType
lastKeyID string No Starts from the event after referenced. (Requires lastKeyTS) “lastKeyID”: “bcId#50002D7D”, “lastKeyTS”: “2017-11-01T17:34:59.801528Z”
lastKeyTS string No Starts from the event after referenced. (Requires lastKeyID) “lastKeyID”: “bcId#50002D7D”, “lastKeyTS”: “2017-11-01T17:34:59.801528Z”
tsStart AND tsEnd dateTime No These optional url parameters must be included together, should be in the standard datetime string format, and will act as ‘between’ selectors (inclusive) for the returned events. tsStart={startTime}&tsEnd={endTime}
Request

	curl \
	-H "Authorization: Basic {Authorization Token}" \
	-X GET "{base_url}/events?"\
		"objectType=bcdPerson&"\
		"objectID=b5d3daebcad1bef1ff660d13ec80a1df"
		
	
Response

	{
	    "events": [
	        {
	            "ts": "2018-01-17T00:00:00.000031Z",
	            "eventID": "eddyUID#3EBC2C6462A6D9E7BF47000000000003",
	            "objectType": "bcdPerson",
	            "objectID": "b5d3daebcad1bef1ff660d13ec80a1df",
	            "edgeMAC": "E4956E4CC2E0",
	            "objectType_id_eventType": "bcdPerson_b5d3daebcad1bef1ff660d13ec80a1df_scanEvent",
	            "groupID": "66679cbce97e147f3ef61122eb63a1a3",
	            "objectType_id": "bcdPerson_b5d3daebcad1bef1ff660d13ec80a1df",
	            "eventType": "scanEvent",
	            "eventBody": {
	                "mac": "D42202000053",
	                "temp": "test_temp",
	                "eddyUID": "3EBC2C6462A6D9E7BF47000000000003"
	            }
	        }
	    ],
	    "count": 1,
	    "lastKeyID": "bcdPerson_b5d3daebcad1bef1ff660d13ec80a1df",
	    "lastKeyTS": "2018-01-17T00:00:00.000031Z"
	}
	

Posting Events

HTTPS Element Request Details
method POST
header Content-Type: application/json, X-API-HEADER: 1
path {base_uri}/events
body {event body}

Event Body

In general for the Event Body, you will have a edgeMac identifier this is where the Events are being posted from.

{
	"edgeMAC":{identifier} 

If you have GPS values, you can have a location dictionary with key value pairs for lat and long. Including values for Lat and long will create a an Edge Location Event. For the locations lat and long, the value can be empty “” or contain a {value}.

  "loc":{  
      		"lat":     "" or {value},
      		"long":    "" or {value},
   }

Nested underneath will be an events list. Time Stamp, an identifier, and eventType is required in each event.

  1. Time stamp is required in this UTC ISO-format: DATE:TIME (2017-07-20T18:42:34.129120Z).

  2. Identifiers are required and can be delivered in two formats:
    • The edge relay format for:
      • iBeac
      • eddyUID
      • bcId
      • btAddr
    • Identifier key value pair:
      • identifier=ibeac#{ibeaconkeyinhex}
      • identifier=eddyUID#{eddystoneUID}
      • identifier=bcId#{bc custom identifier, normally serial number}
      • identifier=btAddr#{bluetooth address}
      • identifier=Whatever {though this does not mean it will be processed by State Logic}
  3. The final thing required for this eventType. There are many different event types. There are other things that can be included in the events. It will be saved but does not necessarily mean it will be processed.
   "events":[  
      {  
         "mac":"D42202000053",
         "ts":"2017-07-20T18:42:34.129120Z",
         "event":"exZone",
         "exZone":"IN",
         "iBeac":"E2C56DB5DFFB48D2B060D0F5A71096E000000000"
      }
   ]
 }  

Here is a complete example that can be sent up as POST. There are many different iterations of how you can POST Events. Save an event.json file to POST.

Example (event.json)

	{  
	   "edgeMAC":"E4956E4CC2E0",
	   "loc":{  
	      "lat":"",
	      "long":"",
	      "fixQual":0,
	      "spd":"",
	      "alt":""
	   },
	   "events":[  
	      {  
	         "mac":"D42202000053",
	         "ts":"2017-07-20T18:42:34.129120Z",
	         "event":"exZone",
	         "exZone":"IN",
	         "iBeac":"E2C56DB5DFFB48D2B060D0F5A71096E000000000"
	      },
	      {  
	         "mac":"D42202000053",
	         "ts":"2017-07-20T18:42:34.205799Z",
	         "event":"enZone",
	         "enZone":"ME",
	         "iBeac":"E2C56DB5DFFB48D2B060D0F5A71096E000000000"
	      },
	      {  
	         "mac":"98072D05F878",
	         "ts":"2017-07-20T18:42:34.273086Z",
	         "event":"enZone",
	         "enZone":"ME"
	      },
	      {  
	         "mac":"A0E6F854F546",
	         "ts":"2017-07-20T18:42:34.816404Z",
	         "event":"enZone",
	         "enZone":"ME"
	      },
	      {  
	         "mac":"44FB9726E7B1",
	         "ts":"2017-07-20T18:42:35.437517Z",
	         "event":"enZone",
	         "enZone":"ME"
	      },
	      {  
	         "mac":"98072D068212",
	         "ts":"2017-07-20T18:42:36.254939Z",
	         "event":"enZone",
	         "enZone":"ME"
	      }
	   ]
	}

	
Request


	curl \
	-H "Authorization: Basic {Authorization Token}" \
	-H "Content-Type: application/json" \
	-H "X-API-HEADER: 1" \
	-X POST --data "@event.json" '{base_url}/events'
	
	
Response

	"Success: 3 events reported"
	

Note: Some of you might be thinking that you need to search events based on objects. However, most people should do a search on state logs!

Logs

There are a few types of resources of type Logs. Whenver there are events, there are processes that store the object data into tables based on the different types of events. One of the most used Log types is x_statelogs. x_statelogs are when an objects state is changed.

For example, when an object of the type bcdEquipment records a different temperature, that is stored in the x_statelogs table.

x_statelogs

		"x_statelog": {
            "name": "x_statelog",
            "displayName": "State Logs",
            "groupID": "764166c0c49c4e113c62f0ca3cecd84e",
            "keys": [
	                {
	                    "name": "id",
	                    "displayName": "ID",
	                    "type": "int"
	                },
	                {
	                    "name": "ts",
	                    "displayName": "Timestamp",
	                    "type": "datetime"
	                },
	                {
	                    "name": "objectid",
	                    "displayName": "Object ID",
	                    "type": "string",
	                    "length": 32
	                },
	                {
	                    "name": "objecttype",
	                    "displayName": "Object Type",
	                    "type": "string",
	                    "length": 100
	                },
	                {
	                    "name": "groupid",
	                    "displayName": "Group ID",
	                    "type": "string",
	                    "length": 32
	                },
	                {
	                    "name": "key",
	                    "displayName": "Key",
	                    "type": "string",
	                    "length": 100
	                },
	                {
	                    "name": "val_str",
	                    "displayName": "String Value",
	                    "type": "string",
	                    "length": 255
	                },
	                {
	                    "name": "val_int",
	                    "displayName": "Int Value",
	                    "type": "int"
	                },
	                {
	                    "name": "val_float",
	                    "displayName": "Decimal Value",
	                    "type": "decimal"
	                },
	                {
	                    "name": "val_bool",
	                    "displayName": "Boolean Value",
	                    "type": "bool"
	                },
	                {
	                    "name": "linkeddata",
	                    "displayName": "Linked Object Data",
	                    "type": "json"
	                },
	                {
	                    "name": "duration",
	                    "displayName": "Duration",
	                    "type": "int"
	                }
	            ]
	        }
        
        

For example, let us say you want to get the statelogs for all of the Devices that have changed from online to offline in the last month. This is jumping ahead but you would do a search query similar to the one below.

x_statelogs Example (search.json)

			{
			  "from": "x_statelog",
			  "select": [
			    {
			      "value": "objecttype"
			    },
			    {
			      "value": "objectid"
			    },
			    {
			      "count": "groups"
			    }
			  ],
			  "groupBy": [
			    "objectid",
			    "objecttype"
			  ],
			  "where": [
			    {
			      "and": [
			        {
			          "objecttype": {
			            "EQ": "Device"
			          }
			        },
			        {
			          "key": {
			            "EQ": "online"
			          }
			        },
			        {
			          "val_bool": {
			            "EQ": true
			          }
			        },
			        {
			          "ts": {
			            "GT": "2018-6-01T00:00:00.000000Z"
			          }
			        }
			      ]
			    }
			  ]
			}

	
x_statelogs Example Request


	curl \
	-H "Authorization: Basic {Authorization Token}" \
	-H "Content-Type: application/json" \
	-H "X-API-HEADER: 1" \
	-X POST --data "@search.json" '{base_url}/search'
	
	
x_statelogs Example Response

	{
    	"x_statelog": [
		        {
		            "objectid": "e4bd189084b0fc81ee79ea97c05d1121",
		            "objecttype": "Device",
		            "count": 2
		        },
		        {
		            "objectid": "a8238d8312a727acf25d405b866bce9e",
		            "objecttype": "Device",
		            "count": 1
		        },
		        {
		            "objectid": "a9ef89929921f0dd17dcd52432d571c2",
		            "objecttype": "Device",
		            "count": 1
		        },
		        {
		            "objectid": "8f6873f8d85bb7ca5688ccd5c2feff3e",
		            "objecttype": "Device",
		            "count": 2
		        },
		        {
		            "objectid": "15a21e12242f80019af10ca6f33b8b8e",
		            "objecttype": "Device",
		            "count": 1
		        },
		        {
		            "objectid": "35b07282d169719144648f4a1eea08b5",
		            "objecttype": "Device",
		            "count": 1
		        }
		    ]
		}
		
	

You then pulled down every Device that went down in the last month and then counted how many times they went offline! As you can see there are many ways to check and use x_statelogs.

Search Endpoint

The search API for Loop can perform queries and analytics on users, objects, and groups. Our API is based off the REST API.

The following examples outlines for API Endpoints and JSON structures with examples using cURL.

POST search

A Search API request contains the following elements:

HTTPS Element Request Details
method POST
header Authorization: Basic {credentials}, Content-Type: application/json, X-API-HEADER: 1
path (req) {base_uri}/search
body JSON of the search request
Request

	curl \
	-H "Authorization: Basic {Authorization Token}" \
	-H "Content-Type: application/json" \
	-H "X-API-HEADER: 1" \
	-X POST --data "@search.json" '{base_url}/search'
	

Search Body

Resource

The search topics send up a body of JSON. The first required key:value pair is from:resource. One of the following resources must be picked from as a string type. Here are a list of the resources:

  • users
  • groups
  • object types
  • object links
  • log types

If you were to query the users resource, you would format it as:

{
    'from': 'users',
    

If you were to query the groups resource, you would format it as:

{
    'from': 'groups',
    

If you were to query the object resource, then a valid objectType of type is string is required in the base level of the JSON.

For the rest of our example, we are going to be querying for an object of the type bcdEquipment. bcdEquipment (bluecatsdemoEquipment) is a broad case scenario for anything that you could consider as equipment that you need to monitor.

{
    'from': 'bcdEquipment', 
} 
    

The next required key is the select query, which is followed by a list with which you values and how you will query them. The where query is not required, but is useful for filtering your results.

{
    'from': 'bcdEquipment', 
    'select': [ *** Select Body *** ]
    'where':  [ *** Where Body  *** ] 
}   

The rest of the search section will explain all of the possible ways for making a select and where queries.

Select Query Body

The select query is what will be contained in the list decide what you will query for. The real meat and potatoes of the query search. There are query selectors, which select on values, or query aggregators, which aggregate values.

Query Selectors

There are a few different types of query selectors you can choose in order to select different values. The query selectors you can use are: value or count.

Query Selector Name Explanation Example
value selects on a type { ‘value’: ‘type’ }
count returns the total number of the objects or groups queried {‘count’: ‘all’} OR {‘count’: ‘groups’ }

Within the select list, can either select for { ‘value’: ‘type’ } and/or { ‘count’: ‘all’} OR {‘count’: ‘groups’ }. Count returns the total number of the object queried. We can query things the serialNumber, temperature, place, and count all bcdEquipment objectTypes that you have ownership of.

count (all or groups): can now have the value ‘all’ or ‘groups’. { ‘count’: ‘all’ } returns the total number of the object queried. {‘count’: ‘groups’} will append a ‘count’ key to the returned objects that has the count of that grouping.

Query Selector Example (search.json)

		{
	    'from': 'bcdEquipment',
	    'select': [
	        { 'value': 'serialNumber' },
	        { 'value': 'temp' },
	        { 'value': 'place' },
	        { 'count': 'all' }
	    	]
		}

	
Query Selector Request


		curl \
		-H "Authorization: Basic {Authorization Token}" \
		-H "Content-Type: application/json" \
		-H "X-API-HEADER: 1" \
		-X POST --data "@search.json" '{base_url}/search'
	
	
Query Selector Response

	{
    	"count": 27,
    	"bcdEquipment": [
		        {
		            "place": null,
		            "serialNumber": "50000B8A",
		            "temp": null
		        },
		        {
		            "place": null,
		            "serialNumber": "5100026A",
		            "temp": 23
		        },
		        {
		            "place": null,
		            "serialNumber": "51000258",
		            "temp": 20
		        },
		        {
		            "place": null,
		            "serialNumber": "C24B7A4FB01D",
		            "temp": null
		        },
		        {
		            "place": null,
		            "serialNumber": "monitor10",
		            "temp": null
		        },
		        {
		            "place": "a7a6c9830a0886c853cd8ec1b74be35a",
		            "serialNumber": "51000274",
		            "temp": 23
		        },
		        {
		            "place": null,
		            "serialNumber": "FE495001F565",
		            "temp": null
		        },
		        {
		            "place": null,
		            "serialNumber": "1234",
		            "temp": null
		        },
		        {
		            "place": null,
		            "serialNumber": "886B0F2C666E",
		            "temp": null
		        },
		        {
		            "place": null,
		            "serialNumber": "886B0F2ADF78",
		            "temp": null
		        },
		        {
		            "place": null,
		            "serialNumber": "automations",
		            "temp": null
		        },
		        {
		            "place": null,
		            "serialNumber": "D3F076DD88E8",
		            "temp": null
		        },
		        {
		            "place": null,
		            "serialNumber": "FFBC258A63B4",
		            "temp": null
		        },
		        {
		            "place": "a7a6c9830a0886c853cd8ec1b74be35a",
		            "serialNumber": "5100023F",
		            "temp": 22
		        },
		        {
		            "place": "ce4d2c276e46678c4d514dfbbb843046",
		            "serialNumber": null,
		            "temp": 3
		        },
		        {
		            "place": null,
		            "serialNumber": "886B0F2A8D53",
		            "temp": null
		        },
		        {
		            "place": null,
		            "serialNumber": "886B0F2C2935",
		            "temp": null
		        },
		        {
		            "place": null,
		            "serialNumber": "",
		            "temp": null
		        },
		        {
		            "place": null,
		            "serialNumber": "50000193",
		            "temp": null
		        },
		        {
		            "place": null,
		            "serialNumber": "5000083D",
		            "temp": null
		        },
		        {
		            "place": null,
		            "serialNumber": "50000177",
		            "temp": null
		        },
		        {
		            "place": null,
		            "serialNumber": "50002C96",
		            "temp": null
		        },
		        {
		            "place": null,
		            "serialNumber": "000780F38F8D",
		            "temp": null
		        },
		        {
		            "place": "a7a6c9830a0886c853cd8ec1b74be35a",
		            "serialNumber": null,
		            "temp": -13
		        },
		        {
		            "place": null,
		            "serialNumber": "886B0F2C0C0D",
		            "temp": null
		        },
		        {
		            "place": null,
		            "serialNumber": "510000D9",
		            "temp": 24
		        },
		        {
		            "place": null,
		            "serialNumber": "E4956E4165F3",
		            "temp": null
		        }
			]
		}
	

Query Aggregators

You can also use query aggregators to combine results such as: sum, min, max, avg. The query aggregators are used via ‘select’. For example:

e.g. { ... “select”: [{“sum”: {column_to_sum} }] ... }

Available on decimal and int type columns, can be used with group_by. Results are in the form column_aggregate. So if you select the ‘duration’ column as ‘avg’, it’ll return the value in the ‘duration_avg’ key.

Query Selector Name Explanation Example
sum aggregates the sum for some value {‘sum’: ‘value’}
min aggregates the minimum for some value {‘min’: ‘value’}
max aggregates the maximum for some value {‘max’: ‘value’}
avg aggregates the average for some value {‘avg’: ‘value’}

For example, what if we want to find the average temperature for all bcdEquipment. So what we would do is create a query {‘avg’: ‘temp’}

Query Aggregator Example (search.json)

		{
    		'from': 'bcdEquipment',
    		'select': [
        		{'count': 'all'}, 
        		{'avg': 'temp'}
    		]
		}
	
Query Aggregator Request


		curl \
		-H "Authorization: Basic {Authorization Token}" \
		-H "Content-Type: application/json" \
		-H "X-API-HEADER: 1" \
		-X POST --data "@search.json" '{base_url}/search'
	
	
Query Aggregator Response

		{
    		"count": 27,
    		"temp_avg": 14
    		"bcdEquipment": [
		        {
		            "temp": null,
		            "place": null,
		            "serialNumber": "50000B8A"
		        },
		        {
		            "temp": 23,
		            "place": null,
		            "serialNumber": "5100026A"
		        },
		        {
		            "temp": 20,
		            "place": null,
		            "serialNumber": "51000258"
		        },
		        {
		            "temp": null,
		            "place": null,
		            "serialNumber": "C24B7A4FB01D"
		        },
		        {
		            "temp": null,
		            "place": null,
		            "serialNumber": "monitor10"
		        },
		        {
		            "temp": 23,
		            "place": "a7a6c9830a0886c853cd8ec1b74be35a",
		            "serialNumber": "51000274"
		        },
		        {
		            "temp": null,
		            "place": null,
		            "serialNumber": "FE495001F565"
		        },
		        {
		            "temp": null,
		            "place": null,
		            "serialNumber": "1234"
		        },
		        {
		            "temp": null,
		            "place": null,
		            "serialNumber": "886B0F2C666E"
		        },
		        {
		            "temp": null,
		            "place": null,
		            "serialNumber": "886B0F2ADF78"
		        },
		        {
		            "temp": null,
		            "place": null,
		            "serialNumber": "automations"
		        },
		        {
		            "temp": null,
		            "place": null,
		            "serialNumber": "D3F076DD88E8"
		        },
		        {
		            "temp": null,
		            "place": null,
		            "serialNumber": "FFBC258A63B4"
		        },
		        {
		            "temp": 22,
		            "place": "a7a6c9830a0886c853cd8ec1b74be35a",
		            "serialNumber": "5100023F"
		        },
		        {
		            "temp": 2,
		            "place": "ce4d2c276e46678c4d514dfbbb843046",
		            "serialNumber": null
		        },
		        {
		            "temp": null,
		            "place": null,
		            "serialNumber": "886B0F2A8D53"
		        },
		        {
		            "temp": null,
		            "place": null,
		            "serialNumber": "886B0F2C2935"
		        },
		        {
		            "temp": null,
		            "place": null,
		            "serialNumber": ""
		        },
		        {
		            "temp": null,
		            "place": null,
		            "serialNumber": "50000193"
		        },
		        {
		            "temp": null,
		            "place": null,
		            "serialNumber": "5000083D"
		        },
		        {
		            "temp": null,
		            "place": null,
		            "serialNumber": "50000177"
		        },
		        {
		            "temp": null,
		            "place": null,
		            "serialNumber": "50002C96"
		        },
		        {
		            "temp": null,
		            "place": null,
		            "serialNumber": "000780F38F8D"
		        },
		        {
		            "temp": -12,
		            "place": "a7a6c9830a0886c853cd8ec1b74be35a",
		            "serialNumber": null
		        },
		        {
		            "temp": null,
		            "place": null,
		            "serialNumber": "886B0F2C0C0D"
		        },
		        {
		            "temp": 24,
		            "place": null,
		            "serialNumber": "510000D9"
		        },
		        {
		            "temp": null,
		            "place": null,
		            "serialNumber": "E4956E4165F3"
		        }
		    ]
		}
	

Optional Query Parameters

  • offset (integer): defaults to 0 and is where to start indexing the objects from
  • limit (integer): defaults to 100 and can be between the values 0-1000
  • orderBy (list of dictionaries): requires at at least one dictionary and has the form of key:value with direction being either ascending or descending: {‘value’: {key}, ‘direction’: asc/desc}
  • ssearch (string): this allows you to search any string
  • groupBy (list of strings): allows you to filter by 1 or more column names.

This query looks for how many batt logs we have per object using groupBy objecttype and objectid and count {"count": "groups"}.

groupBy Request

	
	{
    	"from": "x_statelogs",
    	"select": [
    		{"value": "objecttype"}, 
    		{"value": "objectid"}, 
    		{"count": "groups"}
    	],
    	"groupBy": [
    		"objecttype", 
    		"objectid"
    	]
	}	
	
	
groupBy Response

	{
		"x_battlog": [
	        {
	            "objectid": "bfb402e6c1a3955a495cb6b7acbb2371",
	            "objecttype": "bcdEquipment",
	            "count": 2766
	        },
	        {
	            "objectid": "e704b469467483a6380aa1f9b0d358b7",
	            "objecttype": "bcdEquipment",
	            "count": 2765
	        }
		]
	}

	

groupBy Datepart

Functions are now allowed in group by selections, for now limited to ‘year’, ‘month’, ‘day’, and ‘hour’ on datetime fields, for instance the following query

groupBy Datepart Request

		{
		    "from":"bcdEquipment",
		    "select": [
		    	{"count": "groups"},
	    		{"value": "serialNumber"}
		    ],
		    "groupBy":[
	    		"serialNumber",
		        {"key": "placeChangedAt", "func": "year"},
		        {"key": "placeChangedAt", "func": "month"},
		        {"key": "placeChangedAt", "func": "day"},
		        {"key": "placeChangedAt", "func": "hour"}
			]
		}

	
groupBy Datepart Response


		{
		    "bcdEquipment": [
		        {
		            "serialNumber": null,
		            "count": 2,
		            "placeChangedAt_year": 2018,
		            "placeChangedAt_month": 6,
		            "placeChangedAt_day": 15,
		            "placeChangedAt_hour": 19
		        },
		        {
		            "serialNumber": "",
		            "count": 1,
		            "placeChangedAt_year": null,
		            "placeChangedAt_month": null,
		            "placeChangedAt_day": null,
		            "placeChangedAt_hour": null
		        },
		        {
		            "serialNumber": "000780F38F8D",
		            "count": 1,
		            "placeChangedAt_year": 2018,
		            "placeChangedAt_month": 3,
		            "placeChangedAt_day": 19,
		            "placeChangedAt_hour": 2
		        },
		        {
		            "serialNumber": "1234",
		            "count": 1,
		            "placeChangedAt_year": null,
		            "placeChangedAt_month": null,
		            "placeChangedAt_day": null,
		            "placeChangedAt_hour": null
		        },
		        {
		            "serialNumber": "50000177",
		            "count": 1,
		            "placeChangedAt_year": 2018,
		            "placeChangedAt_month": 3,
		            "placeChangedAt_day": 7,
		            "placeChangedAt_hour": 22
		        },
		        {
		            "serialNumber": "50000193",
		            "count": 1,
		            "placeChangedAt_year": 2018,
		            "placeChangedAt_month": 3,
		            "placeChangedAt_day": 7,
		            "placeChangedAt_hour": 22
		        },
		        {
		            "serialNumber": "5000083D",
		            "count": 1,
		            "placeChangedAt_year": 2018,
		            "placeChangedAt_month": 3,
		            "placeChangedAt_day": 7,
		            "placeChangedAt_hour": 22
		        },
		        {
		            "serialNumber": "50000B8A",
		            "count": 1,
		            "placeChangedAt_year": null,
		            "placeChangedAt_month": null,
		            "placeChangedAt_day": null,
		            "placeChangedAt_hour": null
		        },
		        {
		            "serialNumber": "50002C96",
		            "count": 1,
		            "placeChangedAt_year": 2018,
		            "placeChangedAt_month": 4,
		            "placeChangedAt_day": 11,
		            "placeChangedAt_hour": 21
		        },
		        {
		            "serialNumber": "510000D9",
		            "count": 1,
		            "placeChangedAt_year": 2018,
		            "placeChangedAt_month": 6,
		            "placeChangedAt_day": 11,
		            "placeChangedAt_hour": 11
		        },
		        {
		            "serialNumber": "5100023F",
		            "count": 1,
		            "placeChangedAt_year": 2018,
		            "placeChangedAt_month": 6,
		            "placeChangedAt_day": 15,
		            "placeChangedAt_hour": 19
		        },
		        {
		            "serialNumber": "51000258",
		            "count": 1,
		            "placeChangedAt_year": 2018,
		            "placeChangedAt_month": 4,
		            "placeChangedAt_day": 2,
		            "placeChangedAt_hour": 12
		        },
		        {
		            "serialNumber": "5100026A",
		            "count": 1,
		            "placeChangedAt_year": 2018,
		            "placeChangedAt_month": 6,
		            "placeChangedAt_day": 11,
		            "placeChangedAt_hour": 11
		        },
		        {
		            "serialNumber": "51000274",
		            "count": 1,
		            "placeChangedAt_year": 2018,
		            "placeChangedAt_month": 6,
		            "placeChangedAt_day": 15,
		            "placeChangedAt_hour": 19
		        },
		        {
		            "serialNumber": "886B0F2A8D53",
		            "count": 1,
		            "placeChangedAt_year": null,
		            "placeChangedAt_month": null,
		            "placeChangedAt_day": null,
		            "placeChangedAt_hour": null
		        },
		        {
		            "serialNumber": "886B0F2ADF78",
		            "count": 1,
		            "placeChangedAt_year": null,
		            "placeChangedAt_month": null,
		            "placeChangedAt_day": null,
		            "placeChangedAt_hour": null
		        },
		        {
		            "serialNumber": "886B0F2C0C0D",
		            "count": 1,
		            "placeChangedAt_year": 2018,
		            "placeChangedAt_month": 3,
		            "placeChangedAt_day": 19,
		            "placeChangedAt_hour": 2
		        },
		        {
		            "serialNumber": "886B0F2C2935",
		            "count": 1,
		            "placeChangedAt_year": null,
		            "placeChangedAt_month": null,
		            "placeChangedAt_day": null,
		            "placeChangedAt_hour": null
		        },
		        {
		            "serialNumber": "886B0F2C666E",
		            "count": 1,
		            "placeChangedAt_year": null,
		            "placeChangedAt_month": null,
		            "placeChangedAt_day": null,
		            "placeChangedAt_hour": null
		        },
		        {
		            "serialNumber": "automations",
		            "count": 1,
		            "placeChangedAt_year": null,
		            "placeChangedAt_month": null,
		            "placeChangedAt_day": null,
		            "placeChangedAt_hour": null
		        },
		        {
		            "serialNumber": "C24B7A4FB01D",
		            "count": 1,
		            "placeChangedAt_year": 2018,
		            "placeChangedAt_month": 3,
		            "placeChangedAt_day": 9,
		            "placeChangedAt_hour": 3
		        },
		        {
		            "serialNumber": "D3F076DD88E8",
		            "count": 1,
		            "placeChangedAt_year": null,
		            "placeChangedAt_month": null,
		            "placeChangedAt_day": null,
		            "placeChangedAt_hour": null
		        },
		        {
		            "serialNumber": "E4956E4165F3",
		            "count": 1,
		            "placeChangedAt_year": null,
		            "placeChangedAt_month": null,
		            "placeChangedAt_day": null,
		            "placeChangedAt_hour": null
		        },
		        {
		            "serialNumber": "FE495001F565",
		            "count": 1,
		            "placeChangedAt_year": null,
		            "placeChangedAt_month": null,
		            "placeChangedAt_day": null,
		            "placeChangedAt_hour": null
		        },
		        {
		            "serialNumber": "FFBC258A63B4",
		            "count": 1,
		            "placeChangedAt_year": null,
		            "placeChangedAt_month": null,
		            "placeChangedAt_day": null,
		            "placeChangedAt_hour": null
		        },
		        {
		            "serialNumber": "monitor10",
		            "count": 1,
		            "placeChangedAt_year": null,
		            "placeChangedAt_month": null,
		            "placeChangedAt_day": null,
		            "placeChangedAt_hour": null
		        }
		    ]
		}
	

Place Parent ID

Normally, a user can only see information about an resource (i.e. object, place, etc) if they have ownership of it. The hierarchy prevents users from seeing resources that are above them from a parent group. Place Parent ID is a special key that allows a user to see the place ID of a parent group ID when they normally would not.

  "groups": {
        "keys": [
            {
                "name": "id",
                "displayName": "ID",
                "type": "string",
                "length": 32
            },
            {
                "name": "parentID",
                "displayName": "Parent Group",
                "type": "string",
                "length": 32,
                "link": "groups"
            },
          
            
            . . .


            {
                "name": "placeParentID",
                "displayName": "Place Access Group",
                "type": "string",
                "length": 32,
                "link": "groups"
            }

Search Filters: where

where is a list that allows you to filter on your searches with a few powerful concepts that need to be explained: clause dictionaries (composed of comparison operations), query clause, and clause lists. The bare minimum where filter is using a clause dictionary.

Clause Dictionary

This is a form of a dictionary that allows comparison operations to be performed on keys with some type of value. This takes the form of:

{'key_name': {'comparison operation': 'value' }}

This is all the possible current comparison operations available.

Comparison Operation Name Explanation Example
EQ filters if the value is equal {‘year’: {‘EQ’: 2000 }}
NEQ filters if the value is not equal {‘year’: {‘NEQ’: 400 }}
GT filters if the value is greater than {‘age’: {‘GT’: 25 }}
GE filters if the value is greater than or equal to {‘age’: {‘GE’: 25 }}
LT filters if the value is less than {‘age’: {‘LT’: 25 }}
IN filters if any the values in the list are in the search {‘age’: {‘IN’: [25,30] }}
LE filters if the value is less than or equal to {‘age’: {‘LE’: 25 }}
HAS filters if the key has the value (Requires the string ‘value’) {‘age’: {‘HAS’: ‘value’ }}
HASNO filters if the key has the value (Requires the string ‘value’) {‘age’: {‘HASNO’: ‘value’ }}

Comparison Operation Available for Types

Types Comparison Operations Types Available
string ALL
dateTime ALL
decimal ALL
int ALL
bool EQ, NEQ, HAS, HASNO
json HAS, HASNO

Query List

A query clause is the use of AND or OR. A query list allows is a list type that requires a query clause first and then allows clause dictionaries and/or query lists to be nested. Here is an example of a basic query list with a two clause dictionaries.

where [
    {clause dictionary 1}, 
    {clause dictionary 2}
]

Here is an example of a basic query list with a two clause dictionaries and a nested query list. This queries for when (clause 1 AND clause 2) are true.

where [
    {
        "or":
            [
                {clause dictionary 1}, 
                {
                    "and": {
                        {clause dictionary 2}, 
                        {clause dictionary 3}
                    }
                }
            ]
    }
]

Here is an example of a basic query list with a two clause dictionaries and a nested query list. This queries for when (clause 1 OR (clause 2 AND clause 3)) are true.

For example, let’s say that you want to replace low batteries for your equipment (i.e. bcdEquipment). You would want know the equipments:

  • battery level
  • serial number
  • where that equipment was last seen

You would search from bcdEquipment, select for SN battery life and place. Then you would check if the equipment has a place AND if it has a battery less then 50%.

Clause Dictionary Example File: search.json

	{
	  "from": "bcdEquipment",
	  "select": [ 
	    {"count": "all" },
	    {"value": "serialNumber"},
	    {"value": "batterySoC"},
	    {"value": "place"}
	    
	    ],
	  "where":[
	  	{"and": [
	        		{"place" : {"HAS": "value" }},
	        		{"batterySoC": {"LT": 50}}
	        	]
	        }
	    
	  ]
	}
	
Clause Dictionary Example Request


	curl \ 
	-H "Authorization: Basic {Authorization Token}" \
	-H "Content-Type: application/json" \
	-H "X-API-HEADER: 1" \
	-X POST --data "@search.json" '{base_url}/search' >> bcdEquipment.json
	
Clause Dictionary Example Response

	{
	    "count": 2,
	    "bcdEquipment": [
	        {
	            "place": "ab18fb87bddf4f23a31b6bc9f9b29844",
	            "batterySoC": 47,
	            "serialNumber": "50000193"
	        },
	        {
	            "place": "ab18fb87bddf4f23a31b6bc9f9b29844",
	            "batterySoC": 49,
	            "serialNumber": "5000083D"
	        }
	    ]
	}