Stream Resource

A stream definition is used by GroveStreams to determine how to manage  a set of time-series data. The stream definition is part of a component definition and can only be PUT or POSTed as part of a Component resource JSON representation. See the component resource for more information about creating and saving stream resources as part of the component resource.

There are two types of streams:
  • Interval Streams: Interval stream data consists of data points, each with a start datetime (inclusive) and an end datetime (exclusive) that are accurate to the millisecond. Intervals recur at customizable known interval sizes (every second, minute, month, season, year, ....). Interval streams can be associated with rollup-calendars and when they are, can have roll-up statistical information available as large amounts of data is uploaded. Interval streams can be derived from random streams, point streams, or other interval streams.
  • Random Streams: Random stream data consists of data points, each with a single datetime accurate to the millisecond.  Random streams do not have a rollup-calendar associated with them but still allow roll-up information to be requested. The difference is that random stream rollups have a limit to the amount of samples that can be rolled-up into an interval. Sample streams can be derived from random streams, point streams, or other interval streams. All dependent sample times must match for a sample to be derived from them. Random streams are useful for scenarios such as:
    • Monitoring random events such as when a door or window is opened or when a motion detector is activated
    • Monitoring interval data while preserving the actual time stamp. Interval streams will round the datetime down to the start datetime of the interval and up to the end datetime of the interval the time stamp falls within during a feed upload
    • Monitoring interval data where the sample rate can change dynamically 
Which stream type should you use?
Use Interval Streams if:
  • Your device uploads data at specific intervals (i.e. an electric meter, temperature sensor, a computer resource monitoring feeder)
  • Your device does not need to preserve the actual time stamp of the interval, only the start datetime and end datetime of each interval
  • You want to monitor and use rollup statistics as data arrives for large sets of intervals. Interval streams are optimized for large rollup calculations.
    • Let's go through a scenario where you would want to use an interval stream for large rollups: Your device uploads one minute cycle data and you're required to store the actual second associated with each sample within the minute interval. A random stream will solve the time stamp preservation requirement. You will still have access to roll-up information as data arrives but you will be limited by how many samples can be used in a rollup calculation. You might have access to one-hour or one-day rollup statistics but GroveStreams will raise an exception if you're trying to access one-month or one-year one minute interval size rollup statistics. To work around this restriction, you can create a second interval stream and derive it from your sample stream. Use the interval stream for the large rollup calculations.
Use Random Streams if:
  • Your device uploads data points with random time stamps (i.e. a motion detector sensor)
  • You need to preserve the actual time stamp of each data point for interval streams
  • You want to dynamically change the sample rate on your device
  • You want to monitor roll-up statistics, but the number of samples rolling up into each interval cycle is not a large amount (see limits page)

Random and Interval stream definitions are very similar except interval streams have a few more properties. We list the differences next.

Both random and interval streams are defined by these properties:

  • Name
  • Id: Optional. The id is used during feed uploads to associate feed data to a component stream.
  • Interval Data Type:
    • BOOLEAN
    • SHORT
    • FLOAT
    • DOUBLE
    • BIG_DECIMAL (This type has been implemented but is still in the experimental stage)
    • LONG
    • INTEGER
    • STRING
    • DATETIME
    • LATITUDE
    • LONGITUDE
    • ELEVATION
    • DIRECTION360
    • FILE
  • Default Rollup Method: Used by random streams for dynamic rollup calculations. Also used by the derivation engine for rolling up smaller base cycle interval sizes for interval streams.
  • Delete Profile: Optional. Used by GroveStreams to periodically delete old stream interval data.
  • Default visual information used by the GroveStreams user interface.
  • Constraints: Optional.
    • Minimum/Maximum or Floor/Ceiling constraints are applied to all intervals uploaded (new and historical) prior to saving them. They are not applied to boolean values. String value types will use the string length for comparison against Maximum or Ceiling constraints (note that the floor constraint is ignored for strings). Minimum/Maximum or Floor/Ceiling Constraint Types:
      • NO_MIN_MAX - No minimum/maximum or floor/ceiling constraint
      • ADJUST_TO_FLOOR_CEILING - Has a floor and ceiling
      • ADJUST_TO_GAP - Only used by interval streams. If the interval value is less than the minimum or greater than the maximum then the interval value is set to a Gap (Null).
    • Rollup Percent Set to Gap Constraint: Only used by interval streams. If the percentage of intervals used to calculate a rollup exceed or match this value then the rollup interval will be set to a gap. Percentages are based on the prior rolled up intervals that are used in the rollup calculations. For example, if the base cycle is seconds and the rollup calendar is seconds-hours-days, the days rollup percentage calculation will be based on the number of hour intervals that are gaps. This algorithm ignores time filters for rollup intervals since time filters are only applied to base intervals and this algorithm applies to more than just base cycles.
    • Time Filter Constraint: A stream can optionally reference a time_filter constraint. Uploaded values that are not included by the filter are set to Gaps (Null) values for interval streams and are ignored for random streams. All excluded time filter values are ignored during rollup calculations, gap filling algorithms, and derivation expressions.
Interval Stream Properties
  • Derviation type: Whether it is derived and the type of derivation.
  • Base Cycle: Defines each interval period size of the stream. See cycle resource for more information.
  • Rollup Calendar: Optional. Defines how base cycle data should be rolled up into larger interval sizes. See the rollup_calendar resource for more information.
  • Gap filling: Gap filling only occurs on intervals that are appended to the end of a stream. Gap filling will not be applied to existing interval updates. The gap filling algorithm will fill gaps to the time range between the last non-gap value in the store to the first non-gap value in the range of intervals being added.

    If the stream has a time_filter constraint then the time filter will be respected for all gap filling constraints. Excluded intervals will remain null values.

    Gap Filling Types:
    • NONE - No gap filling
    • PREVIOUS_VAL  - Fill with the previous non-gap value
    • NEXT_VAL - Fill with the next non-gap value
    • AVG - fill with the time weighted average of the previous and next values.
    • MAX - fill with the maximum of the previous and next values.
    • MIN - fill with the minimum of the previous and next values.
Maximum Gaps to Fill: If the number of consecutive gaps calculated exceed this value then they will not be filled. All time filtered excluded intervals will not be part of the gap count.

Cycles and Rollup Calendar
A cycle describes every interval start and end datetime. See the cycle resource for more information.

A rollup calendar describes how a stream's uploaded feed samples are rolled up for viewing and analysis.  If an interval stream has a base cycle set for one second intervals it quickly becomes cumbersome to view and analyze a years worth of data which is 31,536,000 intervals. For the FLOAT data type, 4 bytes, a years worth of data would be about 120 megabytes. Instead of downloading 31 million intervals and sifting through them, a user is better off downloading a set of rolled-up stream data at a larger interval size and then drilling in on the interesting intervals.
Rollup calendars are optional.

Example:
Base Cycle: 1 second
Rollup Calendar: 1 second, 5 minute, 1 day

When the 1 second stream uploads a feed of 10 seconds worth of data into GroveStreams its rollup information is immediately available for every cycle in the rollup calendar as soon has the feed's http REST call returns. So for this example those 10 intervals have statistical values available in their corresponding  5 minute intervals and 1 day intervals.

Rollups respect the time filter that may be associated with a stream. Rollups ignore Gaps during calculations.

All rollup calendar statistics are immediately available and accurate when existing interval data is updated, changed to or from a gap, or deleted.

Rollup statistical information available:
  • First : Returns the first interval value of the underlying cycle
  • Last : Returns the last interval value of the underlying cycle
  • Min : Returns the smallest interval value of the underlying cycle
  • Max : Returns the largest interval value of the underlying cycle
  • Avg : Returns the time weighted average the underlying cycle
  • Sum : Returns the sum of the intervals of the underlying cycle
  • Min Occurrence : Returns the interval start datetime the minimum occurred for the base Cycle
  • Max Occurrence : Returns the interval start datetime the maximum occurred for the base Cycle
  • GapCount : Returns the number of base cycle interval gaps that occurred for this Cycle's range. For example, if the base cycle is 1 Second, the Request Cycle is 1 Year, and the request datetime range is Jan 1, 2010 12:00 am to Jan 1, 2011 12:00 am then a single value representing how many 1 Second intervals are Gaps is returned.
  • NonGapCount : Like GapCount but returns the number of base cycle intervals that are not gaps for the requested datetime range.
  • IntvlCount : Returns the number of base cycle intervals whether they are a gap or not
  • MilliSecCount : Returns the number of milliseconds for the requested datetime range
  • NonGapMilliSecCount : Returns the number of nonGap milliseconds for the requested datetime range

See feed_stats resource for more information about cycle statistics.

Changing Historical Intervals
GroveStreams supports updating existing sample data. You are not charged extra for updating data. Updates have no impact on GroveStreams infrastructure so update all you want. The normal transaction charges will still be applied.



Stream Events
A stream can have zero to many stream events. Each event specifies either an upload latency trigger or a feed interval value expression trigger.

Event Category Types:
  • INFO
  • WARN
  • CRITICAL
Stream Event Properties:
  • Name: The name of the trigger
  • Enabled: Whether the trigger is enabled for this stream
  • eventCategory : see above.
  • cycleRef: The stream's cycle the event will be applied to. A blank cycle uid implies the base cycle. Only applicable to interval streams
  • functionType: If the cycle being referenced is not the base cycle then a functionType is used to determine the function applied to the selected trigger cycle (i.e. MIN, MAX, etc.).
  • expression: Formula expression for trigger. Use the "value" variable within the expression. A trigger is activated when an expression returns a true boolean value.
    • Example: Activate trigger if value is lower than or equal to a floor (10) or higher than or equal to a ceiling (100)
      • value <=10 || value >= 100
  • updateLatency: The number of milliseconds to allow between feed updates before the trigger is activated. Zero indicates no updateLatency trigger. 10 seconds is the minimum (except for zero).
  • delay: The number of milliseconds that will occur between a trigger occurring and actions being performed. If a valid interval value (one that does not activate a trigger) is uploaded after the interval that activated the trigger and it occurred during the delay period, then the original trigger is ignored and no actions are taken. This property is useful for ignoring abnormal interval values. An example of an abnormal value could be the measured ampere amount of an electric motor when it is first started.
  • deliveryFrequency: The number of milliseconds between action delivery until the event stops. Minimum value is 300000 milliseconds or five minutes.  Action delivery will only occur for up to 35 days if they are not acknowledged.
  • start_trigger_action_pkg: This is a reference to an action_pkg. All of the actions within the action_pkg being referenced will be delivered when a trigger starts.
  • stop_trigger_action_pkg: This is a reference to an action_pkg. All of the actions within the action_pkg being referenced will be delivered when a trigger stops.
When a trigger is activated, all of the actions for the Action Package will be performed. See the action_pkg resource for more information.

Interval Stream Derivation
A derived stream has its intervals or samples derived (or calculated) from other streams within an organization. Derivation occurs periodically and only occurs when all dependents have data available for the time period being derived. Different stream rollup cycles (virtual streams) and interval offsets can be used inside a derivation expression. A derived stream can have another derived stream as a variable. Be careful of circular dependencies as the system will not warn you when one occurs. A circular dependency will prevent any calculations from occurring since each stream is waiting for the others intervals to be populated with data.

Derivation Types:
  • NONE
  • FROM_EXPRESSION

When does derivation occur?
GroveStream's will periodically detect (usually every few seconds) when all dependent stream intervals have arrived before doing a derivation. Derivation of an interval may be performed several times depending on the size of the interval and the size of its dependent intervals. If new (not updated) dependent intervals or samples arrive and fall within the interval time range being derived then the derived interval will be calculated with the new interval values. The algorithm for this is a bit complicated as an interval might be derived from another derived variable which is derived from smaller intervals. GroveStreams tracks the smallest dependent interval size end datetime and uses that value within the algorithm to determine interval derivation.

Example: A derived stream has one day cycles but its dependents are one hour cycles. The dependent one hour cycles arrive at different times. The derivation engine will update the derived one day interval several times during a day - whenever all dependent one hour intervals exist for an hour that hasn't been used in a prior derivation.

A stream has three datetimes: start, end and completed. Start is the start datetime of the first interval in the store. End is the end datetime of the last interval in the store. Completed datetimes are used for derivation and are the earliest completed datetime of all dependent streams. If a stream is not a derived stream then its end datetime will be equal to its completed datetime.

Derivation occurs for a stream when all of its dependent streams have completed datetimes that are less than the derived streams' completed datetime. Once a derived interval's end datetime is less than or equal to the streams' completed datetime the derived interval enters a "closed" state. It will not be derived again and derivation moves on to the next set of intervals in the cycle.

Although a derived interval in a "closed" state will not be re-derived but it can be changed via the API or from within the GroveStreams user interface just like any other stream. To force a derivation on "closed" intervals, delete all interval data from a derived stream and the derivation engine will recalculate it all. Not auto deriving "closed" intervals avoids doing dependency tree look-ups every time an interval value changes (as feeds are uploaded). GroveStreams is all about performance and we feel this limitation is acceptable to keep performance high.

Cycles and Functions
A stream can be derived from other streams with different cycle sizes. If the dependent stream's cycle is smaller it will be rolled up to match the size of the derivation stream. The smaller cycle must be able to rollup evenly into the derived interval (1 second into 10 second is an even rollup - 7 second into 1 minute is uneven). The cycle function will be used for the rollup method. If the dependent stream's cycle is larger then the dependent interval with an end datetime that falls within the derived interval will be used.

You can optionally leave the cycle blank (or set to automatic in the user interface). When it is left blank, GroveStreams will select a cycle for you and perform an on-the-fly rollup if needed.

Cycles and Functions are ignored for point stream dependents.

Expressions
Expressions are composed of variables which are stream data points. If a variable is an interval stream, then the user can choose the interval offset for that variable. For example, if an hourly interval with a time span of 2:00 pm to 3:00 pm is being calculated a dependent variables' offset can be set to -1 and that variables' data for time span 1:00 pm to 2:00 will be used in the calculation. Offsets are useful for things like rolling averages.

Example of a Derived Stream Expression that calculates one second 3 pt rolling averages from Component1.Stream1.
Variables:

Variable
Offset
Type
Stream
Cycle
Cycle Function
n
0
Stream
Component1.Stream1
Second
-
n_minus_1
-1
Stream
Component1.Stream1 Second -
n_minus_2 -2
Stream Component1.Stream1 Second -

Expression:
(n + n_minus_1 + n_minus_2) / 3

Expression Features:
  • The ability to mix stream data types in one expression (short, int, long, float, double, string, boolean, ...)
  • Support for "if" operators and boolean expressions (<=,>=, <,>, !=, ==, &&, ||)
  • Standard operators:
    • Power: ^
    • Boolean Not: !
    • Unary Plus, Unary Minus: +x, -x
    • Dot product, cross product: ., ^^
    • Modulus: %
    • Division: /
    • Multiplication: *
    • Addition, Subtraction: +, -
    • Less or Equal, More or Equal: <=, >=
    • Less Than, Greater Than: <,>
    • Not Equal, Equal: !=, ==
    • Boolean And: &&
    • Boolean Or: ||
    • Assignment: =
    • These operators work with strings: +,<=,>=, <,>,!=,==,=
  • Support for functions (only numbers as arguments):
    • trig functions:
      • Sine: sin(x)
      • Cosine: cos(x)
      • Tangent: tan(x)
      • Arc Sine: asin(x)
      • Arc Cosine: acos(x)
      • Arc Tangent: atan(x),
      • Arc Tan with 2 params: atan2(y,x)
      • Secant: sec(x)
      • Cosecant: cosec(x)
      • Co-tangent: cot(x)
      • Hyperbolic Sine: sinh(x)
      • Hyperbolic Cosine: cosh(x)
      • Hyperbolic Tangent: tanh(x)
      • Inverse Hyperbolic Sine: asinh(x)
      • Inverse hyperbolic Cosine: acosh(x)
      • Inverse Hyperbolic Tangent: atanh(x)
    • log and exponential functions:
      • Natural Logarithm: ln(x)
      • Logarithm base 10: log(x)
      • Logarithm base 2: lg(x)
      • Exponential (e^x): exp(x)
      • Power: pow(x)
    • Statistical functions:
      • Average: avg(x1, x2, x3, ...)
      • Minimum: min(x1, x2, x3, ...)
      • Maximum: max(x1, x2, x3, ...)
      • Vector Sum: vsum(x1, x2, x3, ...)
    • Rounding functions:
      • Round: round(x), round(x, p)
      • Round to integer: rint(x), rint(x, p)
      • Floor: floor(x)
      • Ceiling: ceil(x)
    • Other functions
      • if: if(cond, trueval, falseval)
      • Convert number to string: str(x)
      • Absolute Value /Magnitude: abs(x)
      • Random number (between 0 and 1): rand()
      • Modulus: mod(x,y) or x%y
      • Square Root: sqrt(x)
      • Sum: sum(x1, x2, ...)
      • Binomial coefficients: binom(n,i)
      • Signum (-1, 0, 1 depending on sign of argument): signum(x)
    • String functions:
      • Left most characters: left(str, len)
      • Right most characters: right(str, len)
      • Middle (zero based): mid(str, start, len)
      • Substring (zero based): substr(str, start, [end])
      • Lower Case: lower(str)
      • Upper Case: upper(str)
      • Length: len(str)
      • Trim: trim(str)
      • Replace All: replaceall(str, regex, replacement)
      • Replace First: replacefirst(str, regex, replacement)
    • Time:
      • Current time in milliseconds: time()
    • Constants:
      • pi
      • e


Other Expression examples (
Derivation will not occur if the expression returns a result data type that cannot be converted to the derived stream's data type):
  • 1
    • This is a derived stream with no variables. All interval values are set to one during derivation. This kind of derivation is convenient for testing.
  • 2*(n+3)
  • n^2
  • left("test string", 4)
  • 2-cos(n)
  • if(n<n2, true, false)
  • if (n > n2, "stream1 value has exceeded stream2 value", "stream1 value is equal to or less than stream2 value")


Other usages for Derived Streams:
  • A Stream that filters out the Winter on Peak kilowatts
  • A Stream that rolls up from another stream with a smaller cycle interval.
    • This is a good use case for when you don't want to save  a lot of small base cycle intervals (i.e 1 Second) for one stream but you want to keep rollup intervals (i.e 1 Day). Set a small delete profile on the first stream and no delete profile on the derived stream.
  • A Stream that converts Fahrenheit to Celsius
  • A Stream that calculates summer weekend afternoon peak temperatures
  • A Stream that sums all the energy for all plant meters (aggregates a collection of other component streams)
  • A Stream that calculates  energy cost every minute per plant square feet
  • A Stream that measures the distance between two mobile components
  • A Stream that applies a diversity factor
Learning Derivation
The best way to learn about derivation is to create derived feeder streams - create several derived streams with different cycle sizes, rollup calendars, offsets, with no variables and a simple expression that just returns a constant such as 1 or a random number (
rand()). Use these feeder streams as a variable for another stream and validate the results.

/
/ As you can see, Derived Streams are a very powerful tool.


GET component/{compUid}/stream



Returns a list of stream resources for a specific component resource. The list will be returned in the same order they were saved as.
Resource Information
Rate Limited? Yes
session, oauth and org tokens compatible? Yes
api_key token token compatible? Yes

Resource URL

http://grovestreams.com/api/component/{compUid}/stream

Parameters

none


Example Requests

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

Response Body
{
  "message": "",
  "success": true,
  "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"
        },
        "": [

        ],
        "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"
        },       
        "": [

        ],
        "rollupMethod": "AVG",
        "completedDate": 0,
        "streamDerivationType": "NONE",
        "description": "",
        "name": "Temperature C",
        "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"
        },
        "stream_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"
      }
    ]

 
}


GET component/{compUid}/stream/{streamUid}



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

Resource URL

http://grovestreams.com/api/component/{compUid}/stream/{streamUid}

Parameters

none


Example Requests

component/3851c1e5-5c58-490a-825c-8590632434b1/stream/7039044e-055f-40d5-b92c-5f2171434cd1

Response Body
{
    "streamType" : "intvl_stream",
        "baseCycle": {
          "cycle_range": [
           
          ],
          "referenceDate": "2011-01-01T00:00:00",
          "uid": "b2a4da07-5182-4b2e-a1d4-e092e75a82ec",
          "intvlSizeType": "SECOND",
          "description": "cycle description",
          "numSizeTypesPerIntvl": 20,
          "name": "20 Seconds",
          "estimatedIntervalSize": 20000,
          "timeZoneId": ""
        },
        "uid": "7039044e-055f-40d5-b92c-5f2171434cd1",
        "startDate": 1318983360000,
        "rollup_calendar": {
          "uid": "",
          "name": ""
        },
        "constraints": {
          "min": 1,
          "minMaxHandlerType": "ADJUST_TO_GAP",
          "max": 1.7976931348623157E308,
          "rollupPercentSetToGap": 100,
          "time_filter": {
            "uid": "",
            "name": ""
          }
        },
        "devicePermType": "GET",
        "endDate": 1319046680000,
        "gap_filling": {
          "maxGapsToFill": 0,
          "gapFillType": "NONE"
        },
        "delete_profile": {
          "uid": "",
          "name": ""
        },
        "id": "cpu_user",
        "unit": {
          "uid": "",
          "symbol": "",
          "numberFormat": "",
          "name": "",
          "booleanStyle": "TRUE_FALSE",
          "symbolLocation": "AFTER"
        },
        "stream_event": [
          {
            "expression": "value < 0",
            "enabled": true,
            "cycle": {
              "uid": "",
              "name": ""
            },
            "eventCategory" : 'CRITICAL',
            "updateLatency": 0,
            "eventType": "VALUE",
            "functionType": "NONE",
            "name": "Temperature is below zero",
                    "deliveryFrequency": 3600000,
                    "delay": 10000 ,
            "start_trigger_action_pkg": {
              "uid": "5d10bcf8-5897-3a55-9f2c-741bde35edee",
              "name": "All Users"
            } ,
            "stop_trigger_action_pkg": {
              "uid": "",
              "name": ""
            }
          }
        ],
        "rollupMethod": "AVG",
        "completedDate": 1319046680000,
        "streamDerivationType": "NONE",
        "description": "thermometer",
        "name": "CPU User",
        "valueType": "FLOAT",
        "visuals": {
          "defaultChartType": "COL_CHART",
          "hasAxisMinMax": false,
          "chartAxisMax": 200,
          "offset": 0,
          "multiplier": 1,
          "chartAxisMin": -200
        },
        "timeZoneId": "US/Central"
      },


GET component/{compUid}/stream/new




Returns a default stream with a unique UID. It does not persist the new stream in the store. It's the callers responsibility to add the new stream to a component JSON representation and PUT or POST the component.
Resource Information
Rate Limited? Yes
session, oauth and org tokens compatible? Yes
api_key token compatible Yes

Resource URL

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

Parameters

type required
types: rdm_stream, intvl_stream

Example Requests

component/3851c1e5-5c58-490a-825c-8590632434b1/stream/new?type=intvl_stream

Response Body
{
  "message": "",
  "stream": {
  "streamType" : "intvl_stream",
    "baseCycle": {
      "cycle_range": [
       
      ],
      "referenceDate": "",
      "uid": "",
      "intvlSizeType": "MINUTE",
      "description": "",
      "numSizeTypesPerIntvl": 1,
      "name": "",
      "estimatedIntervalSize": 0,
      "timeZoneId": ""
    },
    "uid": "1c27d33f-e7f1-463f-81f6-92111399834a",
    "startDate": 0,
    "rollup_calendar": {
      "uid": "",
      "name": ""
    },
    "constraints": {
      "min": 0,
      "minMaxHandlerType": "NO_MIN_MAX",
      "max": 0,
      "rollupPercentSetToGap": 100,
      "time_filter": {
        "uid": "",
        "name": ""
      }
    },
    "devicePermType": "NONE",
    "endDate": 0,
    "gap_filling": {
      "maxGapsToFill": 0,
      "gapFillType": "NONE"
    },
    "delete_profile": {
      "uid": "",
      "name": ""
    },
    "id": "",
    "unit": {
      "uid": "",
      "symbol": "",
      "numberFormat": "",
      "name": "",
      "booleanStyle": "TRUE_FALSE",
      "symbolLocation": "AFTER"
    },       
    "stream_event": [

        ],
    "rollupMethod": "AVG",
    "completedDate": 0,
    "streamDerivationType": "NONE",
    "description": "",
    "name": "",
    "valueType": "DOUBLE",
    "visuals": {
      "defaultChartType": "LINE_CHART",
      "hasAxisMinMax": false,
      "chartAxisMax": 0,
      "offset": 0,
      "multiplier": 1,
      "chartAxisMin": 0
    },
    "timeZoneId": ""
  },
  "success": true
}



GET /new




Returns a default stream_event with a unique UID. It does not persist the new stream_event in the store. It's the callers responsibility to add the new stream_event to a component' stream JSON representation and PUT or POST the component.
Resource Information
Rate Limited? Yes
session, oauth and org tokens compatible? Yes
api_key token compatible Yes

Resource URL

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

Parameters

none

Example Requests

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

Response Body
{
  "message": "",
  "stream_event" :
         {
            "expression": "",
            "enabled": true,
            "cycle": {
              "uid": "",
              "name": ""
            },
            "eventCategory" : 'CRITICAL',
            "updateLatency": 0,
            "eventType": "VALUE",
            "functionType": "NONE",
            "name": "",
                    "deliveryFrequency": 0,
                    "delay": 0,
            "start_trigger_action_pkg": {
              "uid": "",
              "name": ""
            } ,
            "stop_trigger_action_pkg": {
              "uid": "",
              "name": ""
            }
          }
  },
  "success": true
}