Cycle Resource

A cycle resource represents repeating time periods. It is primarily used to describe the period (or interval sizes) of a stream. Cycles are also used to describe a rollup_calendar resource.

If the cycle is not a custom cycle then the reference datetime is a datetime that one specific cycle interval start datetime falls on. All other stream interval start and end datetimes will be calculated as an offset from the reference date either forwards or backwards in time from the reference date.

The reference date must be in this format: "2011-04-08T01:00:00". Note that this is a string and not in epoch millisecond format. The actual epoch time will be calculated on the fly using either the cycle time zone or the component timezone.

If the timezoneId is blank then the time zone of the component will be used for time calculations.

Interval Size Types:
  • MILLISEC
  • SECOND
  • MINUTE
  • HOUR
  • DAY
  • WEEK
  • MONTH
  • YEAR
  • CUSTOM
For noncustom cycles, datetimes are calculated using the cycle definition, time zone, and reference date. When a cycle is defined as SECOND, MINUTE or HOUR then it is assumed, for performance reasons, that every interval timespan has the same number of milliseconds. Datetimes are derived by calculating the static interval size via intvlSizeType and numSizeTypesPerIntvl and offseting it from the reference time forwards or backwards in time.

For cycle interval size types larger than the type HOUR, the offset calculation is a bit more complex as it may take into account daylight savings time and leap years depending on the time zone referenced. So be aware that a cycle defined as 24 HOUR could give a different result as a cycle defined as 1 DAY.

Time zone ids.

GET cycle



Returns a list of cycle resources.
Resource Information
Rate Limited? Yes
session, oauth and org tokens compatible? Yes
api_key compatible? Yes

Resource URL

http://grovestreams.com/api/cycle

Parameters

none


Example Requests

/cycle

Response Body

{
  "message": "",
  "cycle": [
    {
      "uid": "0f5d35ac-96fd-4956-b6f4-3fedf1e04cc5",
      "description": "cycle description",
      "name": "10 Seconds"
    },
    {
      "uid": "37c32551-a6b9-4a0b-9c06-41d8eb33be9e",
      "description": "cycle description",
      "name": "5 Minutes"
    },
    {
      "uid": "6729adac-f862-46bd-87ce-b0fd6fd9baa8",
      "description": "cycle description",
      "name": "Days"
    },
    {
      "uid": "693d91d9-7bdf-4de3-a55f-ce2fc222b4de",
      "description": "Seasons",
      "name": "Seasons"
    },
    {
      "uid": "9a171122-1d28-4a28-8e5d-55b8a2ee15db",
      "description": "Custom cycle",
      "name": "Custom Months"
    }
  ],
  "success": true
}


GET cycle/{cycleUid}



Returns a cycle with the specified uid.
Resource Information
Rate Limited? Yes
session, oauth and org tokens compatible? Yes
api_key compatible? Yes

Resource URL

http://grovestreams.com/api/cycle/{cycleUid}

Parameters

none


Example Requests

Fixed cycle example.

/cycle/b5a2fa39-8cb6-4c6f-b57f-58850bf45b3f

Response Body

{
  "message": "",
  "cycle": {
    "referenceDate": "2011-01-01T00:00:00",
    "uid": "b5a2fa39-8cb6-4c6f-b57f-58850bf45b3f",
    "cycle_range": [
    ],
    "intvlSizeType": "SECOND",
    "description": "One second interval size",
    "numSizeTypesPerIntvl": 1,
    "name": "Seconds",
    "estimatedIntervalSize": 1000,
    "timeZoneId": ""
  },
  "success": true
}


Custom cycle example.

/cycle/62192a9c-39f7-4190-a50b-75c1d309bb7a

Response Body

{
  "message": "",
  "cycle": {
    "referenceDate": "",
    "uid": "62192a9c-39f7-4190-a50b-75c1d309bb7a",
    "cycle_range": [
      {
        "uid": "f27253e1-68e5-4b7d-8f73-a53577248352",
        "startDate": "2010-03-20T00:00:00",
        "name": "Spring 2010",
        "endDate": "2010-06-21T00:00:00"
      },
      {
        "uid": "00ff8172-64f5-45da-9f10-0f900b2b73bd",
        "startDate": "2010-06-21T00:00:00",
        "name": "Summer 2010",
        "endDate": "2010-09-23T00:00:00"
      },
      {
        "uid": "7910d6e4-3593-47d6-9c34-eb8a6737c9ce",
        "startDate": "2010-09-23T00:00:00",
        "name": "Fall 2010",
        "endDate": "2010-12-21T00:00:00"
      },
      {
        "uid": "fab680c1-b5a5-4ce5-935f-831542bebd4f",
        "startDate": "2010-12-21T00:00:00",
        "name": "Winter 2010",
        "endDate": "2011-03-20T00:00:00"
      },
      {
        "uid": "17f91652-f714-4f93-923a-1730c11e446f",
        "startDate": "2011-03-20T00:00:00",
        "name": "Spring 2011",
        "endDate": "2011-06-21T00:00:00"
      },
      {
        "uid": "1f9e80e5-f416-4962-96e7-92735a4ad61f",
        "startDate": "2011-06-21T00:00:00",
        "name": "Summer 2011",
        "endDate": "2011-09-23T00:00:00"
      },
      {
        "uid": "fadcdd29-d357-46cf-9530-b2a0c54bcac9",
        "startDate": "2011-09-23T00:00:00",
        "name": "Fall 2011",
        "endDate": "2011-12-22T00:00:00"
      },
      {
        "uid": "7788cf37-0b15-47b5-90f4-140d790e3a04",
        "startDate": "2011-12-22T00:00:00",
        "name": "Winter 2011",
        "endDate": "2012-03-20T00:00:00"
      }
    ],
    "intvlSizeType": "CUSTOM",
    "description": "Seasons",
    "numSizeTypesPerIntvl": 1,
    "name": "Seasons",
    "estimatedIntervalSize": 7889400000,
    "timeZoneId": ""
  },
  "success": true
}


GET cycle/new



Returns a default cycle with a unique uid. Does not persist the new cycle. It's the callers responsibility to PUT the new cycle to persist it into the store.
Resource Information
Rate Limited? Yes
session, oauth and org tokens compatible? Yes
api_key compatible Yes

Resource URL

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

Parameters

none

Example Requests

/cycle/new

Response Body

{
  "message": "",
  "cycle": {
    "referenceDate": "2011-01-01T00:00:00",
    "uid": "b5a2fa39-8cb6-4c6f-b57f-58850bf45b3f",
    "cycle_range": [
    ],
    "intvlSizeType": "MINUTE",
    "description": "",
    "numSizeTypesPerIntvl": 1,
    "name": "",
    "estimatedIntervalSize": 0,
    "timeZoneId": ""
  },
  "success": true
}




PUT cycle



Inserts a new cycle.

The uid of the cycle can be blank. If it is blank a unique uid will be generated on the server and the response body will contain the new uid.
Resource Information
Rate Limited? Yes
session, oauth and org tokens compatible? Yes
api_key compatible Yes

Resource URL

http://grovestreams.com/api/cycle

Parameters

parentFolderUid optional
The UID of the tools content repository folder to place this new cycle into. The new cycle will be placed into the root folder if this parameter is missing.

Example Requests

/cycle

Request

{
  "cycle": {
    "uid": "c9a79b59-880b-4e17-8f91-a2d77feb49ae",
    "name": "10 Seconds",
    "description": "Ten second interval size",
    "timeZoneId": "",
    "cycle_range": [
     
    ],
    "intvlSizeType": "SECOND",
    "numSizeTypesPerIntvl": "10",
    "referenceDate": "2011-01-01T00:00:00"
  }
}


POST cycle



Used to update cycle information.
Resource Information
Rate Limited? Yes
session, oauth and org tokens compatible? Yes
api_key compatible Yes

Resource URL

http://grovestreams.com/api/cycle

Parameters

none

Example Requests

/cycle

Request Body
{
  "cycle": {
    "uid": "62192a9c-39f7-4190-a50b-75c1d309bb7a",
    "name": "Seasons",
    "description": "Seasons",
    "timeZoneId": "",
    "cycle_range": [
      {
        "uid": "f27253e1-68e5-4b7d-8f73-a53577248352",
        "name": "Spring 2010",
        "startDate": "2010-03-20T00:00:00",
        "endDate": "2010-06-21T00:00:00"
      },
      {
        "uid": "00ff8172-64f5-45da-9f10-0f900b2b73bd",
        "name": "Summer 2010",
        "startDate": "2010-06-21T00:00:00",
        "endDate": "2010-09-23T00:00:00"
      },
      {
        "uid": "7910d6e4-3593-47d6-9c34-eb8a6737c9ce",
        "name": "Fall 2010",
        "startDate": "2010-09-23T00:00:00",
        "endDate": "2010-12-21T00:00:00"
      },
      {
        "uid": "fab680c1-b5a5-4ce5-935f-831542bebd4f",
        "name": "Winter 2010",
        "startDate": "2010-12-21T00:00:00",
        "endDate": "2011-03-20T00:00:00"
      },
      {
        "uid": "17f91652-f714-4f93-923a-1730c11e446f",
        "name": "Spring 2011",
        "startDate": "2011-03-20T00:00:00",
        "endDate": "2011-06-21T00:00:00"
      },
      {
        "uid": "1f9e80e5-f416-4962-96e7-92735a4ad61f",
        "name": "Summer 2011",
        "startDate": "2011-06-21T00:00:00",
        "endDate": "2011-09-23T00:00:00"
      },
      {
        "uid": "fadcdd29-d357-46cf-9530-b2a0c54bcac9",
        "name": "Fall 2011",
        "startDate": "2011-09-23T00:00:00",
        "endDate": "2011-12-22T00:00:00"
      },
      {
        "uid": "7788cf37-0b15-47b5-90f4-140d790e3a04",
        "name": "Winter 2011",
        "startDate": "2011-12-22T00:00:00",
        "endDate": "2012-03-20T00:00:00"
      },
      {
        "uid": "1a09d0ce-a851-4588-8465-bb1899e9374b",
        "name": "Spring 2012",
        "startDate": "2012-03-20T00:00:00",
        "endDate": "2012-06-20T00:00:00"
      },
      {
        "uid": "4e10815a-add7-4e60-a287-02c99a95ca29",
        "name": "Summer 2012",
        "startDate": "2012-06-20T00:00:00",
        "endDate": "2012-09-22T00:00:00"
      },
      {
        "uid": "a17f8ab1-910b-4701-aba2-437f7f6abe81",
        "name": "Fall 2012",
        "startDate": "2012-09-22T00:00:00",
        "endDate": "2012-12-21T00:00:00"
      },
      {
        "uid": "813b2192-d3e0-4c3c-9703-bc08695f90e3",
        "name": "Winter 2012",
        "startDate": "2012-12-21T00:00:00",
        "endDate": "2013-03-20T00:00:00"
      },
      {
        "uid": "069e0af1-c379-48c9-b6ec-55eadb460fe0",
        "name": "Spring 2013",
        "startDate": "2013-03-20T00:00:00",
        "endDate": "2013-06-21T00:00:00"
      },
      {
        "uid": "7f47501d-3aa0-4137-975c-a9e4573622fb",
        "name": "Summer 2013",
        "startDate": "2013-06-21T00:00:00",
        "endDate": "2013-09-22T00:00:00"
      },
      {
        "uid": "13106988-7f94-4b36-92c6-e3ea72b22141",
        "name": "Fall 2013",
        "startDate": "2013-09-22T00:00:00",
        "endDate": "2013-12-21T00:00:00"
      },
      {
        "uid": "faa03d2f-68e1-4565-b80f-369cabe2b7fd",
        "name": "Winter 2013",
        "startDate": "2013-12-21T00:00:00",
        "endDate": "2014-03-20T00:00:00"
      }
    ],
    "intvlSizeType": "CUSTOM",
    "numSizeTypesPerIntvl": 1,
    "referenceDate": ""
  }
}

DELETE cycle/{cycleUid}



Deletes a cycle. Anything referencing this cycle will no longer reference this cycle and may not work properly including dashboards and stream data in the store or data that is being uploaded/downloaded.
Resource Information
Rate Limited? Yes
session, oauth and org tokens compatible? Yes
api_key compatible Yes

Resource URL

http://grovestreams.com/api/cycle/{cycleUid}

Parameters

none

Example Requests

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

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