Component Resource

A component is a container for a group of streams and events that share the same location. A component represents a real-world physical or abstract device. The component definition is used by GroveStreams so that it can store, organize, map, dashboard and monitor devices.

Defining a Component
A component definition  describes an external device that uploads information into GroveStreams.   GroveStreams needs to know certain attributes about the device such as what data type a stream interval will be so that it can properly store and display the interval data.

A component are defined by JSON. Assembling JSON by hand can be tedious so the GroveStreams website has a component definition view that makes it easy to define and validate your components.

Component UID:
Every component (and any other GroveStreams entity) has a uid (universal identifier) assigned to it. This identifier is unique throughout the GroveStreams store and cannot be changed. Components are mostly identified and requested by their uids.

Component ID:
Components can optionally have an external unique ID. The ID could be a MAC address or a device serial number or any other string that is unique within your organization. You can use this ID to retrieve components from GroveStreams. The ID attribute comes in handy for devices that self register. For example, a zigbee device that enters a mesh network can use its MAC address as a
GroveStreams component ID to look-up whether it is already registered with GroveStreams or not.

Component Templates
Use a component template to quickly create a component manually or automatically when a new device becomes available. The GroveStreams API provides the capability for a device to determine if it is already registered. If it is not registered it will create a new component from a template and return its definition all in one API call (see component PUT and GET commands below or feed PUT command). Components can also be automatically created from templates during feed PUT calls. See Feed PUT.

Streams
A stream definition describes data points. The order of a component's streams is preserved during a PUT and POST and is significant as a device can upload a component's feed using the feed order in the JSON array to determine which component stream it belongs to. This avoids the device having to know a stream uid or id.

See the stream resource for more information about streams.


Mobility
A component can be marked as fixed or mobile and it can contain longitude,  latitude or elevation random or interval streams. These streams can track a component's location over time. GroveStreams will plot a components current location on maps.

Reconciling
Component definitions can change after stream data exists. Existing data may need to be transformed when this occurs.

Stream data is stored according to the definition of the component stream. For example, if the stream is defined as DOUBLE data type then the values are stored as
DOUBLEs. If that stream is later defined as INTEGER then all existing intervals within the store need to be changed to INTEGER types. During the saving of a component, GroveStreams will detect changes that require modifications to stored data and create a Reconcile Job. The Reconcile Job will run asynchronously and can be monitored and cancelled from the GroveStreams API or from the GroveStreams web user interface.

GroveStreams will throw an error if a reconcile isn't possible. Sometimes GroveStreams cannot detect if an interval conversion is possible or not since it depends on the actual value of each interval. Each interval that cannot be converted will be changed to a Gap interval for interval streams or removed for random streams during a reconcile.

Component stream reconciling is performed across servers (each stream is a task) and is relatively fast but its not fast enough for the system to hold a lock on a stream and prevent data from being downloaded or uploaded during a reconcile. GroveStreams is designed to allow stream feeds to be uploaded or downloaded during a stream reconcile as long as the data is appended to the start or end of the stream.

There is a very short window of time (usually under a second) at the end of the Reconcile Job when GroveStreams will lock the stream. Any stream requests during this short period of time may return a REQUEST_VALIDATION_FAILURE. If this occurs the user or device should retry the request.

Changes that will create a Reconcile Job (if stream intervals exists in the store):
  • Component time zone id change
  • Stream data type change
  • Stream base cycle change
  • Stream rollup_calendar change
  • Stream derivation change
  • Stream time_filter change
Deleting a component
When a component is deleted, all stream data is also deleted. Any item referencing a component, or its streams , will no longer reference them (dashboards, derived streams, ...).

For a list of time zone ids see:
Time zone ids

GET component



Returns a list of component resources. Components can also be referenced by a component_folder folder. Use the component_folder resource to add or remove a component from a folder. Resource Information
Rate Limited?
Yes
session and org tokens compatible?
Yes
api_key token token compatible?
Yes


Resource URL

http://grovestreams.com/api/component

Parameters

There are three possible sets of parameters. The first two sets return a list of components.
 
start
required
Set this to a zero-based offset into the list.
limit
required
Set this to the maximum number of components to return.
sort
required
This is only required if not querying by bounding box. Set to "name". "name" is the only sorting attribute supported to date.
dir
required
This is only required if not querying by bounding box. Set to "ASC" or "DESC", for ascending and descending.

Bounding Box parameters (start and limit are required, sort and dir are ignored if these parameters are used).
startLng
optional
Starting longitude - inclusive
endLng
optional Ending longitude - inclusive
startLat
optional Starting latitude - inclusive
endLat
optional Ending latitude - inclusive

If the id parameter is used all other parameters are ignored.
id
optional
The id of an existing component to return. Returns the full component definition.

If the detailAmount parameter is used all other parameters are ignored.
detailAmount
optional
If set to 'forQuickView' then the component definition is returned along with the last several intervals (default: 10) for each stream.
numIntvls
optional
If detailAmount is set to 'forQuickView' then numIntvls can be used to indicate how many intervals or samples for each stream to return.

Example Requests

Bounding Box Example:

/component?start=0&limit=1000&startLng=-95.16983032226562&endLng=-91.56356811523438&startLat=44.51315545869885&endLat=45.739734958168505
 
Response Body
{
  "message": "",
  "success": true,
  "component": [
    {
      "uid": "cd826b54-93db-4c84-9601-56c8637ba57b",
      "location": {
        "longitude": -94.25644,
        "latitude": 45.196342
      },
      "name": "Cabin Component"
    }
  ]
}


Sorted List Example:

/component
/ ?start=0&limit=1000&sort=name&dir=ASC

Response Body
{
  "message": "",
  "success": true,
  "totalCount": 2,
  "component": [
    {
      "uid": "3eee4898-6142-4d72-957f-7957d8d47fb5",
      "creationDate": 1301925777161,
      "description": "Computer Resources",
      "name": "My Computer",
      "disposition": "FIXED",
      "timeZoneId": ""
    },
    {
      "uid": "cd826b54-93db-4c84-9601-56c8637ba57b",
      "creationDate": 1301925783701,
      "description": "",
      "name": "Cabin",
      "disposition": "FIXED",
      "timeZoneId": ""
    }
  ]
}


Query by Id example:

/component?id=MAX_123
 


GET component/{componentUid}



Returns a component with the specified uid.
Resource Information
Rate Limited?
Yes
session and org tokens compatible?
Yes
api_key token compatible?
Yes


Resource URL

http://grovestreams.com/api/component/{componentUid}

Parameters

forQuickView optional
Returns enough information for component quick view. If this parameter is used then all others are ignored.
forPicker optional
Returns enough information for a component selection picker.

Example Requests

/component/3851c1e5-5c58-490a-825c-8590632434b1

Response Body
{
  "message": "",
  "success": true,
  "component": {
    "id": "MAC_123",
    "uid": "900d6a66-fed5-4a48-a251-b0477661da50",
    "creationDate": 0,
    "stream": [
      {
        "streamType" : "intvl_stream",
        "baseCycle": {
          "cycle_range": [
           
          ],
          "referenceDate": "2011-01-01T00:00:00",
          "uid": "6ff373a2-8efb-4ea7-9ec7-2d770bb980b2",
          "intvlSizeType": "SECOND",
          "description": "cycle description",
          "numSizeTypesPerIntvl": 1,
          "name": "Seconds",
          "estimatedIntervalSize": 1000,
          "timeZoneId": ""
        },
        "uid": "b01585b2-dca7-4c3e-9683-b980ce72d8c4",
        "startDate": 0,
        "rollup_calendar": {
          "uid": "11b0a967-a445-43b5-9af8-4f2a1bddd8c5",
          "name": "Years, Quarters, Months, Days, Hour, FiveMin"
        },
        "constraints": {
          "min": 1,
          "minMaxHandlerType": "ADJUST_TO_GAP",
          "max": 1.7976931348623157E308,
          "rollupPercentSetToGap": 100,
          "time_filter": {
            "uid": "",
            "name": ""
          }
        },
        "devicePermType": "GET",
        "endDate": 0,
        "gap_filling": {
          "maxGapsToFill": 0,
          "gapFillType": "NONE"
        },
        "delete_profile": {
          "uid": "",
          "name": ""
        },
        "id": "",
        "unit": {
          "uid": "2f1f8839-ec0d-4dfc-9564-e04bf01ca05b",
          "symbol": " nm",
          "numberFormat": "0,000.00",
          "name": "Brightness",
          "booleanStyle": "ON_OFF",
          "symbolLocation": "AFTER"
        },
        "comp_event": [
         {
            "expression": "value == 0",
            "enabled": true,
            "cycle": {
              "uid": "",
              "name": ""
            },
            "updateLatency": 0,
"eventType": "VALUE",
            "functionType": "NONE",
            "name": "No Light",
            "start_trigger_action_pkg": {
              "uid": "5d10bcf8-5897-3a55-9f2c-741bde35edee",
              "name": "All Users"
            }
          }

        ],
        "rollupMethod": "AVG",
        "completedDate": 0,
        "streamDerivationType": "NONE",
        "description": "",
        "name": "light",
        "valueType": "FLOAT",
        "visuals": {
          "defaultChartType": "COL_CHART",
          "hasAxisMinMax": false,
          "chartAxisMax": 200,
          "offset": 0,
          "multiplier": 1,
          "chartAxisMin": -200
        },
        "timeZoneId": "UTC"
      },
      {
        "streamType" : "intvl_stream",
        "baseCycle": {
          "cycle_range": [
           
          ],
          "referenceDate": "2011-01-01T00:00:00",
          "uid": "6ff373a2-8efb-4ea7-9ec7-2d770bb980b2",
          "intvlSizeType": "SECOND",
          "description": "cycle description",
          "numSizeTypesPerIntvl": 1,
          "name": "Seconds",
          "estimatedIntervalSize": 1000,
          "timeZoneId": ""
        },
        "uid": "036d9dde-b410-43dc-8a4d-785940528c9f",
        "startDate": 0,
        "rollup_calendar": {
          "uid": "11b0a967-a445-43b5-9af8-4f2a1bddd8c5",
          "name": "Years, Quarters, Months, Days, Hour, FiveMin"
        },
        "constraints": {
          "min": 1,
          "minMaxHandlerType": "ADJUST_TO_GAP",
          "max": 1.7976931348623157E308,
          "rollupPercentSetToGap": 100,
          "time_filter": {
            "uid": "",
            "name": ""
          }
        },
        "devicePermType": "GET",
        "endDate": 0,
        "gap_filling": {
          "maxGapsToFill": 0,
          "gapFillType": "NONE"
        },
        "delete_profile": {
          "uid": "",
          "name": ""
        },
        "id": "",
        "unit": {
          "uid": "8efe14fa-8d0f-4d66-8633-520cadfb7080",
          "symbol": "C",
          "numberFormat": "0,000.00",
          "name": "Celsius",
          "booleanStyle": "ON_OFF",
          "symbolLocation": "AFTER"
        },
        "comp_event": [
         {
            "expression": "value < 0",
            "enabled": true,
            "cycle": {
              "uid": "",
              "name": ""
            },
            "updateLatency": 0,
"eventType": "VALUE",
            "functionType": "NONE",
            "name": "Temperature is below freezing",
            "start_trigger_action_pkg": {
              "uid": "5d10bcf8-5897-3a55-9f2c-741bde35edee",
              "name": "All Users"
            }
          }

        ],
        "rollupMethod": "AVG",
        "completedDate": 0,
        "streamDerivationType": "NONE",
        "description": "",
        "name": "temperature",
        "valueType": "FLOAT",
        "visuals": {
          "defaultChartType": "COL_CHART",
          "hasAxisMinMax": false,
          "chartAxisMax": 200,
          "offset": 0,
          "multiplier": 1,
          "chartAxisMin": -200
        },
        "timeZoneId": "UTC"
      },
      {
        "streamType" : "intvl_stream",
        "baseCycle": {
          "cycle_range": [
           
          ],
          "referenceDate": "2011-01-01T00:00:00",
          "uid": "6ff373a2-8efb-4ea7-9ec7-2d770bb980b2",
          "intvlSizeType": "SECOND",
          "description": "cycle description",
          "numSizeTypesPerIntvl": 1,
          "name": "Seconds",
          "estimatedIntervalSize": 1000,
          "timeZoneId": ""
        },
        "uid": "78fa2d43-816d-41d0-a379-300bd6e936ca",
        "startDate": 0,
        "rollup_calendar": {
          "uid": "",
          "name": ""
        },
        "constraints": {
          "min": 1,
          "minMaxHandlerType": "ADJUST_TO_GAP",
          "max": 1.7976931348623157E308,
          "rollupPercentSetToGap": 100,
          "time_filter": {
            "uid": "",
            "name": ""
          }
        },
        "devicePermType": "GET",
        "endDate": 0,
        "gap_filling": {
          "maxGapsToFill": 0,
          "gapFillType": "NONE"
        },
        "delete_profile": {
          "uid": "",
          "name": ""
        },
        "id": "",
        "unit": {
          "uid": "3b160a5e-73d2-46c6-ac5e-a1dbf0430687",
          "symbol": "",
          "numberFormat": "0,000.00",
          "name": "No Symbol",
          "booleanStyle": "ON_OFF",
          "symbolLocation": "AFTER"
        },       
        "comp_event": [

        ],
        "rollupMethod": "AVG",
        "completedDate": 0,
        "streamDerivationType": "NONE",
        "description": "",
        "name": "low_battery",
        "valueType": "BOOLEAN",
        "visuals": {
          "defaultChartType": "COL_CHART",
          "hasAxisMinMax": false,
          "chartAxisMax": 200,
          "offset": 0,
          "multiplier": 1,
          "chartAxisMin": -200
        },
        "timeZoneId": "UTC"
      }
    ],
    "location": {
      "postalCode": "20024-3210",
      "hasAltitude": false,
      "description": "",
      "altitude": 0,
      "street": "300 E Street SW",
      "stateOrProvince": "DC",
      "longitude": -94.15644,
      "latitude": 47.196342,
      "country": "United States",
      "city": "Washington"
    },
    "description": "",
    "name": "light and humidity sensor",
    "ownerUser": {
      "uid": "89ec79e6-4d0b-4abd-9172-2296f4703812",
      "name": "Fred Flintstone"
    },
"compTmpl": {
      "uid": "d73a6e9b-2300-3dfd-8386-01cc945e60cf",
      "name": "Template 1"
    },
    "disposition": "FIXED",
    "timeZoneId": "US/Eastern"
  }
}


GET component/{componentUid}/location



Returns a component's current location.
Resource Information
Rate Limited? Yes
session and org tokens compatible?
Yes
api_key token compatible
Yes


Resource URL

http://grovestreams.com/api/component/{componentUid}/location

Parameters

time
optional
The location of the component at the given time. The component's current location will be returned if the time parameter is not included.

Example Requests

Get the component's current location.

/component/9f53ea01-070d-401e-a708-25726a249d2d/location

Response Body {
  "message": "",
  "success": true,
  "location": {
      "postalCode": "20024-3210",
      "hasAltitude": false,
      "description": "",
      "altitude": 0,
      "street": "300 E Street SW",
      "stateOrProvince": "DC",
      "longitude": -94.15644,
      "latitude": 47.196342,
      "country": "United States",
      "city": "Washington"
    }
}


GET component/new



Returns a default component with a unique UID. Does not persist the new component in the store. It's the callers responsibility to PUT the new component and register it.
Resource Information
Rate Limited? Yes
session and org tokens compatible?
Yes
api_key token compatible
Yes


Resource URL

http://grovestreams.com/api/component/new

Parameters

templateUid optional
Uses the component template with the uid that matches templateUid to create a new component. Does not persist the component.
templateId optional
Uses a component template with an id that matches templateId to create a new component. Does not persist the component.

Example Requests

/component/new

Response Body
{
  "message": "",
  "success": true,
  "component": {
    "uid": "9f53ea01-070d-401e-a708-25726a249d2d",
    "stream": [
     
    ],
    "location": {
      "postalCode": "",
      "hasAltitude": false,
      "description": "",
      "altitude": 0,
      "street": "",
      "stateOrProvince": "",
      "longitude": 0,
      "latitude": 0,
      "country": "",
      "city": ""
    },
    "ownerUser": {
      "uid": "",
      "name": ""
    },
,     "compTmpl": {
      "uid": "",
      "name": ""
    },
    "version": 0,
    "id": "",
    "creationDate": 1316462069063,
    "description": "",
    "name": "",
    "disposition": "FIXED",
    "timeZoneId": ""
  }
}




PUT component



Inserts a new component.

The uid of the component can be blank. If it is blank a uid will be created on the server and the response body will contain the new uid.

This method can also create a new component based on a component template. Send with an empty entity body or a body with component defaults that are applied after the component is created from the template. See the parameters below.
Resource Information
Rate Limited? Yes
session and org tokens compatible?
Yes
api_key token compatible
Yes


Resource URL

http://grovestreams.com/api/component

Parameters

These three parameters allow a component to be created from a component template.

parentFolderUid optional
The UID of the component content repository folder to place this new component into. The component will be placed into the root folder if this parameter is missing.
deviceId optional
The value to set the new component's ID to when it is being created from a component template (requires either templateUid or templateId parameter to be passed in the call). If a component with an ID that matches deviceId exists, it will be returned with this call without applying any template or default values.
templateUid
optional
templateUid is the uid of the component template to create the component from. The deviceId parameter can optionally be passed in. A JSON body containing component defautls can optionally be included.
templateId
optional
The id of the component template to create the component from. The deviceId parameter can optionally be passed in. A JSON body containing component defautls can optionally be included.

Example Requests

 This example demondstrates creating a component based on a template while applying component defaults. If a deviceId is passed on the URL and a componentId is included in the JSON defaults, the URL deviceId will be used.:

/component?templateId=template1


Request Body

{
  "component":
    {
      "defaults": {
        "location": {
          "stateOrProvince": "NJ"
        },
        "name": "smart plug",
        "folderPath" : "/home/kitchen"
      },
      "componentId": "MAC4563454"
    }
  }
}


This example demonstrates creating a component:

/component


Request Body
{
  "component": {
    "id": "MAC_1234",
    "uid": "fd1e1906-1049-4aaf-8e58-2630b607bf07",
    "creationDate": 0,
    "stream": [
      {
        "streamType" : "intvl_stream",
        "baseCycle": {
          "uid": "6ff373a2-8efb-4ea7-9ec7-2d770bb980b2"
        },
        "uid": "c62c4098-3a84-4088-a3dd-b0dc3514cbf5"
        "rollup_calendar": {
          "uid": "11b0a967-a445-43b5-9af8-4f2a1bddd8c5"
        },
        "constraints": {
          "min": 1,
          "minMaxHandlerType": "ADJUST_TO_GAP",
          "max": 1.7976931348623157E308,
          "rollupPercentSetToGap": 100,
          "time_filter": {
            "uid": ""
          }
        },
        "devicePermType": "GET",
        "gap_filling": {
          "maxGapsToFill": 100,
          "gapFillType": "PREVIOUS_VAL"
        },
        "delete_profile": {
          "uid": ""
        },
        "id": "",
        "unit": {
          "uid": "2f1f8839-ec0d-4dfc-9564-e04bf01ca05b"
        },
        "rollupMethod": "AVG",
        "streamDerivationType": "NONE",
        "description": "",
        "name": "light",
        "valueType": "FLOAT",
        "visuals": {
          "defaultChartType": "COL_CHART",
          "hasAxisMinMax": false,
          "chartAxisMax": 200,
          "offset": 0,
          "multiplier": 1,
          "chartAxisMin": -200
        }
      },
      {
        "streamType" : "intvl_stream",
        "baseCycle": {
          "uid": "6ff373a2-8efb-4ea7-9ec7-2d770bb980b2""
        },
        "uid": "20747785-068f-4fc2-beb1-82835a46b245"
        "rollup_calendar": {
          "uid": "11b0a967-a445-43b5-9af8-4f2a1bddd8c5"
        },
        "constraints": {
          "min": 1,
          "minMaxHandlerType": "ADJUST_TO_GAP",
          "max": 1.7976931348623157E308,
          "rollupPercentSetToGap": 100,
          "time_filter": {
            "uid": ""
          }
        },
        "devicePermType": "GET",
        "gap_filling": {
          "maxGapsToFill": 50,
          "gapFillType": "AVG"
        },
        "delete_profile": {
          "uid": ""
        },
        "id": "",
        "unit": {
          "uid": "8efe14fa-8d0f-4d66-8633-520cadfb7080"
        },
        "comp_event": [
 
        ],
        "rollupMethod": "AVG",
        "streamDerivationType": "NONE",
        "description": "",
        "name": "temperature",
        "valueType": "FLOAT",
        "visuals": {
          "defaultChartType": "COL_CHART",
          "hasAxisMinMax": false,
          "chartAxisMax": 200,
          "offset": 0,
          "multiplier": 1,
          "chartAxisMin": -200
        }
      },
      {
        "streamType" : "intvl_stream",
        "baseCycle": {
          "uid": "6ff373a2-8efb-4ea7-9ec7-2d770bb980b2"
        },
        "uid": "c1475a99-ec85-4b08-9cde-1b3270e470a9",
        "rollup_calendar": {
          "uid": "11b0a967-a445-43b5-9af8-4f2a1bddd8c5"
        },
        "constraints": {
          "min": 1,
          "minMaxHandlerType": "ADJUST_TO_GAP",
          "max": 1.7976931348623157E308,
          "rollupPercentSetToGap": 100,
          "time_filter": {
            "uid": ""
          }
        },
        "devicePermType": "GET",
        "gap_filling": {
          "maxGapsToFill": 3,
          "gapFillType": "MAX"
        },
        "delete_profile": {
          "uid": ""
        },
        "id": "",
        "unit": {
          "uid": "dd47299c-5649-46e4-aa10-28febbc5cd1a"
        },
        "rollupMethod": "AVG",
        "streamDerivationType": "NONE",
        "description": "",
        "name": "current",
        "valueType": "FLOAT",
        "visuals": {
          "defaultChartType": "COL_CHART",
          "hasAxisMinMax": false,
          "chartAxisMax": 200,
          "offset": 0,
          "multiplier": 1,
          "chartAxisMin": -200
        }
      },
      {
        "streamType" : "intvl_stream",
        "baseCycle": {
          "uid": "6ff373a2-8efb-4ea7-9ec7-2d770bb980b2"
        },
        "uid": "688f2f6b-db43-44f8-8b4d-7e01d6bb517f",
        "rollup_calendar": {
          "uid": "11b0a967-a445-43b5-9af8-4f2a1bddd8c5"
        },
        "intvl_expression": {
          "expression": "(current * 120 / (3600 * 1000)) * costPerKwh",
          "dependent": [
            {
              "dependentUid": "c1475a99-ec85-4b08-9cde-1b3270e470a9",
              "dependentName": "",
              "streamIntvlOffset": 0,
              "cycleName": "",
              "componentName": "",
              "cycleUid": "6ff373a2-8efb-4ea7-9ec7-2d770bb980b2",
              "dependentType": "stream",
              "functionType": "NONE",
              "name": "current",
              "componentUid": "fd1e1906-1049-4aaf-8e58-2630b607bf07",
              "time_filter": [
               
              ]
            },
            {
              "dependentUid": "9b73dd8d-3c28-493b-9295-a5d78321cd2a",
              "dependentName": "",
              "streamIntvlOffset": 0,
              "cycleName": "",
              "componentName": "",
              "cycleUid": "",
              "dependentType": "stream",
              "functionType": "NONE",
              "name": "costPerKwh",
              "componentUid": "fd1e1906-1049-4aaf-8e58-2630b607bf07",
              "time_filter": [
               
              ]
            }
          ],
          "effectiveDate": 1316391359973
        },
        "constraints": {
          "min": 1,
          "minMaxHandlerType": "ADJUST_TO_GAP",
          "max": 1.7976931348623157E308,
          "rollupPercentSetToGap": 100,
          "time_filter": {
            "uid": ""
          }
        },
        "devicePermType": "GET"
        "gap_filling": {
          "maxGapsToFill": 0,
          "gapFillType": "NONE"
        },
        "delete_profile": {
          "uid": ""
        },
        "id": "",
        "unit": {
          "uid": "ec7d4c63-2caf-4d84-8fc3-e4bec3a2ede1"
        },
        "rollupMethod": "AVG",
        "streamDerivationType": "FROM_EXPRESSION",
        "description": "",
        "name": "cost",
        "valueType": "FLOAT",
        "visuals": {
          "defaultChartType": "COL_CHART",
          "hasAxisMinMax": false,
          "chartAxisMax": 200,
          "offset": 0,
          "multiplier": 1,
          "chartAxisMin": -200
        }
      },
      {
        "streamType" : "intvl_stream",
        "baseCycle": {
          "uid": "6ff373a2-8efb-4ea7-9ec7-2d770bb980b2"
        },
        "uid": "362973e4-0350-4d66-bbd1-8ff46c47ca46",
        "rollup_calendar": {
          "uid": "11b0a967-a445-43b5-9af8-4f2a1bddd8c5"
        },
        "intvl_expression": {
          "expression": "(if(isNull(currentMinus0), 0, currentMinus0) + if(isNull(currentMinus1), 0, currentMinus1) + if(isNull(currentMinus2), 0, currentMinus2))/3",
          "dependent": [
            {
              "dependentUid": "c1475a99-ec85-4b08-9cde-1b3270e470a9",
              "dependentName": "",
              "streamIntvlOffset": 0,
              "cycleName": "",
              "componentName": "",
              "cycleUid": "6ff373a2-8efb-4ea7-9ec7-2d770bb980b2",
              "dependentType": "stream",
              "functionType": "NONE",
              "name": "currentMinus0",
              "componentUid": "fd1e1906-1049-4aaf-8e58-2630b607bf07",
              "time_filter": [
               
              ]
            },
            {
              "dependentUid": "c1475a99-ec85-4b08-9cde-1b3270e470a9",
              "dependentName": "",
              "streamIntvlOffset": -1,
              "cycleName": "",
              "componentName": "",
              "cycleUid": "6ff373a2-8efb-4ea7-9ec7-2d770bb980b2",
              "dependentType": "stream",
              "functionType": "NONE",
              "name": "currentMinus1",
              "componentUid": "fd1e1906-1049-4aaf-8e58-2630b607bf07",
              "time_filter": [
               
              ]
            },
            {
              "dependentUid": "c1475a99-ec85-4b08-9cde-1b3270e470a9",
              "dependentName": "",
              "streamIntvlOffset": -2,
              "cycleName": "",
              "componentName": "",
              "cycleUid": "6ff373a2-8efb-4ea7-9ec7-2d770bb980b2",
              "dependentType": "stream",
              "functionType": "NONE",
              "name": "currentMinus2",
              "componentUid": "fd1e1906-1049-4aaf-8e58-2630b607bf07",
              "time_filter": [
               
              ]
            }
          ],
          "effectiveDate": 1316391300973,
        },
        "constraints": {
          "min": 1,
          "minMaxHandlerType": "ADJUST_TO_GAP",
          "max": 1.7976931348623157E308,
          "rollupPercentSetToGap": 100,
          "time_filter": {
            "uid": ""
          }
        },
        "devicePermType": "GET",
        "gap_filling": {
          "maxGapsToFill": 0,
          "gapFillType": "NONE"
        },
        "delete_profile": {
          "uid": ""
        },
        "id": "",
        "unit": {
          "uid": "dd47299c-5649-46e4-aa10-28febbc5cd1a"
        },
        "comp_event": [

        ],
        "rollupMethod": "AVG",
        "streamDerivationType": "FROM_EXPRESSION",
        "description": "",
        "name": "current - Rolling 3pt Avg",
        "valueType": "FLOAT",
        "visuals": {
          "defaultChartType": "COL_CHART",
          "hasAxisMinMax": false,
          "chartAxisMax": 200,
          "offset": 0,
          "multiplier": 1,
          "chartAxisMin": -200
        }
      },
      {
        "streamType" : "intvl_stream",
        "baseCycle": {
          "uid": "6ff373a2-8efb-4ea7-9ec7-2d770bb980b2"
        },
        "uid": "9dbfbc11-50f6-4991-a83c-fd4daded6595",
        "rollup_calendar": {
          "uid": "11b0a967-a445-43b5-9af8-4f2a1bddd8c5"
        },
        "intvl_expression": {
          "expression": "cost / sqFeet",
          "dependent": [
            {
              "dependentUid": "688f2f6b-db43-44f8-8b4d-7e01d6bb517f",
              "dependentName": "",
              "streamIntvlOffset": 0,
              "cycleName": "",
              "componentName": "",
              "cycleUid": "6ff373a2-8efb-4ea7-9ec7-2d770bb980b2",
              "dependentType": "stream",
              "functionType": "NONE",
              "name": "cost",
              "componentUid": "fd1e1906-1049-4aaf-8e58-2630b607bf07",
              "time_filter": [
               
              ]
            },
            {
              "dependentUid": "2e473282-cf8e-451b-9476-d8f430ed5a33",
              "dependentName": "",
              "streamIntvlOffset": 0,
              "cycleName": "",
              "componentName": "",
              "cycleUid": "",
              "dependentType": "stream",
              "functionType": "NONE",
              "name": "sqFeet",
              "componentUid": "fd1e1906-1049-4aaf-8e58-2630b607bf07",
              "time_filter": [
               
              ]
            }
          ],
          "effectiveDate": 1316391300973
        },
        "constraints": {
          "min": 1,
          "minMaxHandlerType": "ADJUST_TO_GAP",
          "max": 1.7976931348623157E308,
          "rollupPercentSetToGap": 100,
          "time_filter": {
            "uid": ""
          }
        },
        "devicePermType": "GET",
        "gap_filling": {
          "maxGapsToFill": 0,
          "gapFillType": "NONE"
        },
        "delete_profile": {
          "uid": ""
        },
        "id": "",
        "unit": {
          "uid": "ec7d4c63-2caf-4d84-8fc3-e4bec3a2ede1"
        },
        "rollupMethod": "AVG",
        "streamDerivationType": "FROM_EXPRESSION",
        "description": "",
        "name": "cost per sq feet",
        "valueType": "FLOAT",
        "visuals": {
          "defaultChartType": "COL_CHART",
          "hasAxisMinMax": false,
          "chartAxisMax": 200,
          "offset": 0,
          "multiplier": 1,
          "chartAxisMin": -200
        }
      },
      {
        "streamType" : "intvl_stream",
        "baseCycle": {
          "uid": "6ff373a2-8efb-4ea7-9ec7-2d770bb980b2"
        },
        "uid": "90c5b3c4-ce8a-4169-ba45-57ef1b0019f1",
        "rollup_calendar": {
          "uid": ""
        },
        "constraints": {
          "min": 1,
          "minMaxHandlerType": "ADJUST_TO_GAP",
          "max": 1.7976931348623157E308,
          "rollupPercentSetToGap": 100,
          "time_filter": {
            "uid": ""
          }
        },
        "devicePermType": "SET",
        "gap_filling": {
          "maxGapsToFill": 0,
          "gapFillType": "NONE"
        },
        "delete_profile": {
          "uid": ""
        },
        "id": "",
        "unit": {
          "uid": "3b160a5e-73d2-46c6-ac5e-a1dbf0430687"
        },
        "rollupMethod": "AVG",
        "streamDerivationType": "NONE",
        "description": "",
        "name": "power_on",
        "valueType": "BOOLEAN",
        "visuals": {
          "defaultChartType": "COL_CHART",
          "hasAxisMinMax": false,
          "chartAxisMax": 200,
          "offset": 0,
          "multiplier": 1,
          "chartAxisMin": -200
        }
      }
    ],
    "location": {
      "postalCode": "",
      "hasAltitude": false,
      "description": "Cabin Refridgerator",
      "altitude": 0,
      "street": "",
      "stateOrProvince": "",
      "longitude": -94.25591776794431,
      "latitude": 47.262320232064745,
      "country": "",
      "city": ""
    },
    "description": "Smart Plug that measures light, temp, current. Cost and rolling 3pt Avg are derived.",
    "name": "smartplug",
    "ownerUser": {
      "uid": "89ec79e6-4d0b-4abd-9172-2296f4703812"
    },
    "disposition": "FIXED",
    "timeZoneId": "US/Central"
  }
}

PUT component/{componentUid}/reconcile_changes



Use this call to determine if the changes to a component entity will require a reconcile job to be created. This call will return a list of any reconcile changes the changes will require.
Resource Information
Rate Limited? Yes
session and org tokens compatible?
Yes
api_key token compatible
Yes


Resource URL

http://grovestreams.com/api/component/{componentUid}/reconcile_changes

Parameters

These three parameters allow a component to be created from a component template.

none

Example Requests

/component/9f53ea01-070d-401e-a708-25726a249d2d/reconcile_changes

Request Body
A component entity. See component PUT above.

Response Body
{
  "message": "",
  "change": [
    {
      "message": "Stream 'CPU Used' interval data type was changed from 'DOUBLE' to 'FLOAT'. Existing interval data will be preserved if the change is compatible. Noncompatible interval changes will result in gap (null value) intervals.",
      "item": {
        "uid": "d0ed52fb-1a9b-4dae-860d-79bb2bc60674",
        "name": "CPU Used",
        "type": "stream"
      }
    },
    {
      "message": "Stream 'Physical Total Memory - bytes' base cycle was changed from '10 Seconds' to 'Seconds'. This will require all existing interval data to be modified using the default rollup method as a guide.",
      "item": {
        "uid": "fb0cb1ab-dba6-437f-8674-5ade8d4a26f6",
        "name": "Physical Total Memory - bytes",
        "type": "stream"
      }
    }
  ],
  "success": true
}




POST component



Used to update an existing component.
Resource Information
Rate Limited? Yes
session and org tokens compatible?
Yes
api_key token compatible
Yes


Resource URL

http://grovestreams.com/api/component

Parameters

none

Example Requests

/component

Request
Body
{
  "component": {
    "id": "MAC_1234",
    "uid": "fd1e1906-1049-4aaf-8e58-2630b607bf07",
    "creationDate": 0,
    "stream": [
      {
    "streamType" : "intvl_stream",
        "baseCycle": {
          "uid": "6ff373a2-8efb-4ea7-9ec7-2d770bb980b2"
        },
        "uid": "c62c4098-3a84-4088-a3dd-b0dc3514cbf5"
        "rollup_calendar": {
          "uid": "11b0a967-a445-43b5-9af8-4f2a1bddd8c5"
        },
        "constraints": {
          "min": 1,
          "minMaxHandlerType": "ADJUST_TO_GAP",
          "max": 1.7976931348623157E308,
          "rollupPercentSetToGap": 100,
          "time_filter": {
            "uid": ""
          }
        },
        "devicePermType": "GET",
        "gap_filling": {
          "maxGapsToFill": 100,
          "gapFillType": "PREVIOUS_VAL"
        },
        "delete_profile": {
          "uid": ""
        },
        "id": "",
        "unit": {
          "uid": "2f1f8839-ec0d-4dfc-9564-e04bf01ca05b"
        },
        "rollupMethod": "AVG",
        "streamDerivationType": "NONE",
        "description": "",
        "name": "light",
        "valueType": "FLOAT",
        "visuals": {
          "defaultChartType": "COL_CHART",
          "hasAxisMinMax": false,
          "chartAxisMax": 200,
          "offset": 0,
          "multiplier": 1,
          "chartAxisMin": -200
        }
      },
      {
    "streamType" : "intvl_stream",
        "baseCycle": {
          "uid": "6ff373a2-8efb-4ea7-9ec7-2d770bb980b2""
        },
        "uid": "20747785-068f-4fc2-beb1-82835a46b245"
        "rollup_calendar": {
          "uid": "11b0a967-a445-43b5-9af8-4f2a1bddd8c5"
        },
        "constraints": {
          "min": 1,
          "minMaxHandlerType": "ADJUST_TO_GAP",
          "max": 1.7976931348623157E308,
          "rollupPercentSetToGap": 100,
          "time_filter": {
            "uid": ""
          }
        },
        "devicePermType": "GET",
        "gap_filling": {
          "maxGapsToFill": 50,
          "gapFillType": "AVG"
        },
        "delete_profile": {
          "uid": ""
        },
        "id": "",
        "unit": {
          "uid": "8efe14fa-8d0f-4d66-8633-520cadfb7080"
        },
        "rollupMethod": "AVG",
        "streamDerivationType": "NONE",
        "description": "",
        "name": "temperature",
        "valueType": "FLOAT",
        "visuals": {
          "defaultChartType": "COL_CHART",
          "hasAxisMinMax": false,
          "chartAxisMax": 200,
          "offset": 0,
          "multiplier": 1,
          "chartAxisMin": -200
        }
      },
      {
    "streamType" : "intvl_stream",
        "baseCycle": {
          "uid": "6ff373a2-8efb-4ea7-9ec7-2d770bb980b2"
        },
        "uid": "c1475a99-ec85-4b08-9cde-1b3270e470a9",
        "rollup_calendar": {
          "uid": "11b0a967-a445-43b5-9af8-4f2a1bddd8c5"
        },
        "constraints": {
          "min": 1,
          "minMaxHandlerType": "ADJUST_TO_GAP",
          "max": 1.7976931348623157E308,
          "rollupPercentSetToGap": 100,
          "time_filter": {
            "uid": ""
          }
        },
        "devicePermType": "GET",
        "gap_filling": {
          "maxGapsToFill": 3,
          "gapFillType": "MAX"
        },
        "delete_profile": {
          "uid": ""
        },
        "id": "",
        "unit": {
          "uid": "dd47299c-5649-46e4-aa10-28febbc5cd1a"
        },
        "rollupMethod": "AVG",
        "streamDerivationType": "NONE",
        "description": "",
        "name": "current",
        "valueType": "FLOAT",
        "visuals": {
          "defaultChartType": "COL_CHART",
          "hasAxisMinMax": false,
          "chartAxisMax": 200,
          "offset": 0,
          "multiplier": 1,
          "chartAxisMin": -200
        }
      },
      {
    "streamType" : "intvl_stream",
        "baseCycle": {
          "uid": "6ff373a2-8efb-4ea7-9ec7-2d770bb980b2"
        },
        "uid": "688f2f6b-db43-44f8-8b4d-7e01d6bb517f",
        "rollup_calendar": {
          "uid": "11b0a967-a445-43b5-9af8-4f2a1bddd8c5"
        },
        "intvl_expression": {
          "expression": "(current * 120 / (3600 * 1000)) * costPerKwh",
          "dependent": [
            {
              "dependentUid": "c1475a99-ec85-4b08-9cde-1b3270e470a9",
              "dependentName": "",
              "streamIntvlOffset": 0,
              "cycleName": "",
              "componentName": "",
              "cycleUid": "6ff373a2-8efb-4ea7-9ec7-2d770bb980b2",
              "dependentType": "stream",
              "functionType": "NONE",
              "name": "current",
              "componentUid": "fd1e1906-1049-4aaf-8e58-2630b607bf07",
              "time_filter": [
               
              ]
            },
            {
              "dependentUid": "9b73dd8d-3c28-493b-9295-a5d78321cd2a",
              "dependentName": "",
              "streamIntvlOffset": 0,
              "cycleName": "",
              "componentName": "",
              "cycleUid": "",
              "dependentType": "stream",
              "functionType": "NONE",
              "name": "costPerKwh",
              "componentUid": "fd1e1906-1049-4aaf-8e58-2630b607bf07",
              "time_filter": [
               
              ]
            }
          ],
          "effectiveDate": 1316391359973
        },
        "constraints": {
          "min": 1,
          "minMaxHandlerType": "ADJUST_TO_GAP",
          "max": 1.7976931348623157E308,
          "rollupPercentSetToGap": 100,
          "time_filter": {
            "uid": ""
          }
        },
        "devicePermType": "GET"
        "gap_filling": {
          "maxGapsToFill": 0,
          "gapFillType": "NONE"
        },
        "delete_profile": {
          "uid": ""
        },
        "id": "",
        "unit": {
          "uid": "ec7d4c63-2caf-4d84-8fc3-e4bec3a2ede1"
        },
        "rollupMethod": "AVG",
        "streamDerivationType": "FROM_EXPRESSION",
        "description": "",
        "name": "cost",
        "valueType": "FLOAT",
        "visuals": {
          "defaultChartType": "COL_CHART",
          "hasAxisMinMax": false,
          "chartAxisMax": 200,
          "offset": 0,
          "multiplier": 1,
          "chartAxisMin": -200
        }
      },
      {
    "streamType" : "intvl_stream",
        "baseCycle": {
          "uid": "6ff373a2-8efb-4ea7-9ec7-2d770bb980b2"
        },
        "uid": "362973e4-0350-4d66-bbd1-8ff46c47ca46",
        "rollup_calendar": {
          "uid": "11b0a967-a445-43b5-9af8-4f2a1bddd8c5"
        },
        "intvl_expression": {
          "expression": "(if(isNull(currentMinus0), 0, currentMinus0) + if(isNull(currentMinus1), 0, currentMinus1) + if(isNull(currentMinus2), 0, currentMinus2))/3",
          "dependent": [
            {
              "dependentUid": "c1475a99-ec85-4b08-9cde-1b3270e470a9",
              "dependentName": "",
              "streamIntvlOffset": 0,
              "cycleName": "",
              "componentName": "",
              "cycleUid": "6ff373a2-8efb-4ea7-9ec7-2d770bb980b2",
              "dependentType": "stream",
              "functionType": "NONE",
              "name": "currentMinus0",
              "componentUid": "fd1e1906-1049-4aaf-8e58-2630b607bf07",
              "time_filter": [
               
              ]
            },
            {
              "dependentUid": "c1475a99-ec85-4b08-9cde-1b3270e470a9",
              "dependentName": "",
              "streamIntvlOffset": -1,
              "cycleName": "",
              "componentName": "",
              "cycleUid": "6ff373a2-8efb-4ea7-9ec7-2d770bb980b2",
              "dependentType": "stream",
              "functionType": "NONE",
              "name": "currentMinus1",
              "componentUid": "fd1e1906-1049-4aaf-8e58-2630b607bf07",
              "time_filter": [
               
              ]
            },
            {
              "dependentUid": "c1475a99-ec85-4b08-9cde-1b3270e470a9",
              "dependentName": "",
              "streamIntvlOffset": -2,
              "cycleName": "",
              "componentName": "",
              "cycleUid": "6ff373a2-8efb-4ea7-9ec7-2d770bb980b2",
              "dependentType": "stream",
              "functionType": "NONE",
              "name": "currentMinus2",
              "componentUid": "fd1e1906-1049-4aaf-8e58-2630b607bf07",
              "time_filter": [
               
              ]
            }
          ],
          "effectiveDate": 1316391300973,
        },
        "constraints": {
          "min": 1,
          "minMaxHandlerType": "ADJUST_TO_GAP",
          "max": 1.7976931348623157E308,
          "rollupPercentSetToGap": 100,
          "time_filter": {
            "uid": ""
          }
        },
        "devicePermType": "GET",
        "gap_filling": {
          "maxGapsToFill": 0,
          "gapFillType": "NONE"
        },
        "delete_profile": {
          "uid": ""
        },
        "id": "",
        "unit": {
          "uid": "dd47299c-5649-46e4-aa10-28febbc5cd1a"
        },
        "rollupMethod": "AVG",
        "streamDerivationType": "FROM_EXPRESSION",
        "description": "",
        "name": "current - Rolling 3pt Avg",
        "valueType": "FLOAT",
        "visuals": {
          "defaultChartType": "COL_CHART",
          "hasAxisMinMax": false,
          "chartAxisMax": 200,
          "offset": 0,
          "multiplier": 1,
          "chartAxisMin": -200
        }
      },
      {
    "streamType" : "intvl_stream",
        "baseCycle": {
          "uid": "6ff373a2-8efb-4ea7-9ec7-2d770bb980b2"
        },
        "uid": "9dbfbc11-50f6-4991-a83c-fd4daded6595",
        "rollup_calendar": {
          "uid": "11b0a967-a445-43b5-9af8-4f2a1bddd8c5"
        },
        "intvl_expression": {
          "expression": "cost / sqFeet",
          "dependent": [
            {
              "dependentUid": "688f2f6b-db43-44f8-8b4d-7e01d6bb517f",
              "dependentName": "",
              "streamIntvlOffset": 0,
              "cycleName": "",
              "componentName": "",
              "cycleUid": "6ff373a2-8efb-4ea7-9ec7-2d770bb980b2",
              "dependentType": "stream",
              "functionType": "NONE",
              "name": "cost",
              "componentUid": "fd1e1906-1049-4aaf-8e58-2630b607bf07",
              "time_filter": [
               
              ]
            },
            {
              "dependentUid": "2e473282-cf8e-451b-9476-d8f430ed5a33",
              "dependentName": "",
              "streamIntvlOffset": 0,
              "cycleName": "",
              "componentName": "",
              "cycleUid": "",
              "dependentType": "stream",
              "functionType": "NONE",
              "name": "sqFeet",
              "componentUid": "fd1e1906-1049-4aaf-8e58-2630b607bf07",
              "time_filter": [
               
              ]
            }
          ],
          "effectiveDate": 1316391300973
        },
        "constraints": {
          "min": 1,
          "minMaxHandlerType": "ADJUST_TO_GAP",
          "max": 1.7976931348623157E308,
          "rollupPercentSetToGap": 100,
          "time_filter": {
            "uid": ""
          }
        },
        "devicePermType": "GET",
        "gap_filling": {
          "maxGapsToFill": 0,
          "gapFillType": "NONE"
        },
        "delete_profile": {
          "uid": ""
        },
        "id": "",
        "unit": {
          "uid": "ec7d4c63-2caf-4d84-8fc3-e4bec3a2ede1"
        },
        "rollupMethod": "AVG",
        "streamDerivationType": "FROM_EXPRESSION",
        "description": "",
        "name": "cost per sq feet",
        "valueType": "FLOAT",
        "visuals": {
          "defaultChartType": "COL_CHART",
          "hasAxisMinMax": false,
          "chartAxisMax": 200,
          "offset": 0,
          "multiplier": 1,
          "chartAxisMin": -200
        }
      },
      {
    "streamType" : "intvl_stream",
        "baseCycle": {
          "uid": "6ff373a2-8efb-4ea7-9ec7-2d770bb980b2"
        },
        "uid": "90c5b3c4-ce8a-4169-ba45-57ef1b0019f1",
        "rollup_calendar": {
          "uid": ""
        },
        "constraints": {
          "min": 1,
          "minMaxHandlerType": "ADJUST_TO_GAP",
          "max": 1.7976931348623157E308,
          "rollupPercentSetToGap": 100,
          "time_filter": {
            "uid": ""
          }
        },
        "devicePermType": "SET",
        "gap_filling": {
          "maxGapsToFill": 0,
          "gapFillType": "NONE"
        },
        "delete_profile": {
          "uid": ""
        },
        "id": "",
        "unit": {
          "uid": "3b160a5e-73d2-46c6-ac5e-a1dbf0430687"
        },
        "rollupMethod": "AVG",
        "streamDerivationType": "NONE",
        "description": "",
        "name": "power_on",
        "valueType": "BOOLEAN",
        "visuals": {
          "defaultChartType": "COL_CHART",
          "hasAxisMinMax": false,
          "chartAxisMax": 200,
          "offset": 0,
          "multiplier": 1,
          "chartAxisMin": -200
        }
      }
    ],
    "location": {
      "postalCode": "",
      "hasAltitude": false,
      "description": "Cabin Refridgerator",
      "altitude": 0,
      "street": "",
      "stateOrProvince": "",
      "longitude": -94.25591776794431,
      "latitude": 47.262320232064745,
      "country": "",
      "city": ""
    },
    "description": "Smart Plug that measures light, temp, current. Cost and rolling 3pt Avg are derived.",
    "name": "smartplug",
    "ownerUser": {
      "uid": "89ec79e6-4d0b-4abd-9172-2296f4703812"
    },
    "disposition": "FIXED",
    "timeZoneId": "US/Central"
  }
}

DELETE component/{componentUid}



Deletes a component.
Resource Information
Rate Limited? Yes
session and org tokens compatible?
Yes
api_key token compatible
Yes


Resource URL

http://grovestreams.com/api/component/{componentUid}

Parameters

none

Example Requests

/component/d251a8f2-f7b9-4df7-886d-b24c7f4929d4

Response Body
{
    "message" : "Deleted component with uid 'd251a8f2-f7b9-4df7-886d-b24c7f4929d4 '",
    "success" : true
}