HomeGuidesRecipesAPI ReferenceChangelog
Log In
API Reference

A Calendar defines important dates that are associated with tariffs, including billing dates, holiday schedules (which are typically off-peak and thus have lower rates), and "dynamic" events such as smart days, critical peaks, and system peaks. The Calendar endpoints allow you to query what calendars are available and what dates they specify.

Data Definitions

Calendar has a resource type of Calendar. An individual date has a resource type of CalendarDate. Each calendar has a list of events on it that denotes the type of dates on the calendar. For example "billing period end" would be an event on a billing period calendar, and Easter Sunday would be an event on a holiday calendar. Then Easter Sunday 2015 is a calendar date, as is the specific billing period end date of June 12, 2015.

Calendar

A Calendar is a simple object that has the following data structure.

NameTypeFieldsDescription
calendarIdLongMA unique ID for each calendar
calendarNameStringMA descriptive name for the calendar. If the utility gives it a name (they typically do for billing cycles) it will be that. Otherwise its indicative of its purpose (e.g. "Holidays").
calendarTypeStringMIndicates the type of dates in this calendar. Values are HOLIDAY (e.g. 4th July), BILLING (for billing periods) and PRICING_PERIOD for dynamic pricing events like critical peaks.
lseIdLongMThe ID of the utility (LSE) that the calendar belongs to.
eventsList of CalendarEventA list of the types of events on this calendar (See below for CalendarEvent structure). This is only populated on Get Calendar, not on Get Calendars.

Each CalendarEvent item in the events list above has the following fields:

NameTypeFieldsDescription
calendarEventIdLongMA unique ID for each calendar event
calendarEventNameStringMShort, descriptive name for the event
lseIdLongMThe ID of the utility (LSE) that the calendar belongs to.
calendarEventTypeStringMEither HOLIDAY, BILLING or PRICING_PERIOD
dateDefinitionTypeStringEFIXED_DATE occurs on the same date, MANUAL is non-deterministic, FLOATING_DATE floats (e.g. first Monday of the month), and EASTER_DATE relates to the easter calendar
localeStringISO Country Code of the locale's date (e.g. US).
seededUntilDateWhen the underlying dates for this event are populated through to.
fixedMonthIntegerEFor fixed dates, the month of year.
fixedDayIntegerEFor fixed dates, the day of month.
dayOfWeekIntegerEFor floating dates, the day of the week.
weekOfMonthIntegerEFor floating dates, the week of the month.
adjustmentIntegerEAn adjustment value is used for various date types.

Calendar Date

The actual dates are provided in the CalendarDate resource type.

NameTypeFieldsDescription
eventDateIdLongMA unique ID for this specific calendar date
subKeyStringMTypically null. Populated for System Peak events
eventNameLongMShort descriptive name of the event
startDateTimeDateTimeMDate and time the event date starts. Typically midnight, but not always.
endDateTimeDateTimeMTypically null, but populated when the calendar date is for a period other than 1 whole day
calendarEventIdLongMThe ID of the dates calendar event
lseIdLongMThe utility that the calendar date belongs to

Get Calendars

This endpoint returns all of the calendars that match the passed-in request arguments.

Resource URI

GET /rest/public/calendars/

Request Parameters

NameTypeDescription
lseIdLonglseId (Optional).
calendarTypeStringType of calendar. Can be either HOLIDAY, BILLING, or PRICING_PERIOD (Optional).

Example 1: Get all the Holidays Calendars for a Utility

GET /rest/public/calendars?lseId=734&calendarType=HOLIDAY
{  
   "status": "success",  
   "count": 5,  
   "type": "Calendar",  
   "results": [  
      {  
         "calendarId": 2,  
         "calendarName": "Holidays",  
         "calendarType": "HOLIDAY",  
         "lseId": 734  
      },  
      {  
         "calendarId": 86,  
         "calendarName": "Holidays",  
         "calendarType": "HOLIDAY",  
         "lseId": 734  
      },  
      {  
         "calendarId": 634,  
         "calendarName": "Holiday-Peaks",  
         "calendarType": "HOLIDAY",  
         "lseId": 734  
      },  
      {  
         "calendarId": 646,  
         "calendarName": "Holidays - Summer",  
         "calendarType": "HOLIDAY",  
         "lseId": 734  
      },  
      {  
         "calendarId": 647,  
         "calendarName": "Holidays - Winter",  
         "calendarType": "HOLIDAY",  
         "lseId": 734  
      }  
   ],  
   "pageStart": 0,  
   "pageCount": 25  
}  
{% endhighlight %}

Example 2: Get all the Billing Cycle Calendars for a Utility

GET /rest/public/calendars?lseId=734&calendarType=BILLING
{  
   "status": "success",  
   "count": 21,  
   "type": "Calendar",  
   "results": [  
      {  
         "calendarId": 705,  
         "calendarName": "Read Cycle B",  
         "calendarType": "BILLING",  
         "lseId": 734  
      },
      {  
         "calendarId": 726,  
         "calendarName": "Read Cycle Z",  
         "calendarType": "BILLING",  
         "lseId": 734  
      }  
   ],  
   "pageCount": 25,  
   "pageStart": 0  
}

Get Calendar

The endpoint returns the Calendar and its events for the given calendarId. You can optionally filter events by a given date range.

Resource URI

GET /rest/public/calendars/{calendarId}

Request Parameters

NameTypeDescription
calendarIdTypeCalender Id
fromDateTimeDateTimefrom date (Optional)
toDateTimeDateTimeto date (Optional)

Example

GET /rest/public/calendars/2
{  
	"status": "success",  
	"count": 1,  
	"type": "Calendar",  
	"results": [  
	{  
		"calendarId": 2,  
		"calendarName": "Holidays",  
		"calendarType": "HOLIDAY",  
		"lseId": 734,  
		"events": [  
		{  
			"calendarEventId": 2,  
			"calendarEventName": "New Year's Day",  
			"lseId": null,  
			"calendarEventType": "HOLIDAY",  
			"locale": "US",  
			"seededUntil": "2017-01-01"  
		},
    	/* edited for length */

}]
}

Get Calendar Dates

Returns actual dates of events for the given criteria, which includes date ranges, lseId filters.

Resource URI

GET /rest/public/calendars/dates

Request Parameters

NameTypeDescription
calendarIdLongOptionally return only dates for a given calendar.
lseIdLongOptional filter for a given utility. Since calendars belong to LSEs, you don't need to send this if sending calendarId.
localeStringOptional ISO country code of the locale you are interested in (e.g. US).
fromDateTimeDateTimeEvent dates on or after this date (Optional).
toDateTimeDateTimeEvent dates on or before this date (Optional).
calendarEventTypesStringComma-separated string that indicates the calendar event types to include. Choices are: HOLIDAY, BILLING, PRICING_PERIOD (Optional).
dateDefinitionTypesStringComma-separated string that indicates the date definition types to include. Choices are: FIXED_DATE, MANUAL, FLOATING_DATE, EASTER_DATE (Optional).

Example

GET /rest/public/calendars/dates
{  
	"status": "success",  
	"count": 37381,  
	"type": "CalendarDate",  
	"results": [  
		{  
			"eventDateId": 2,  
			"subKey": null,  
			"eventName": "New Year's Day",  
			"startDateTime": "2010-01-01T00:00:00+00:00",  
			"endDateTime": null,  
			"calendarEventId": 2,  
			"lseId": 2654  
		},  
		{  
			"eventDateId": 2,  
			"subKey": null,  
			"eventName": "New Year's Day",  
			"startDateTime": "2010-01-01T00:00:00+00:00",  
			"endDateTime": null,  
			"calendarEventId": 2,  
			"lseId": 734  
		},
    	/* edited for length */
    }