Schedule Service

The Schedule Service allows you to retrieve schedules, create new schedules, delete schedules, retrieve the number of current schedules. Only a single event can be created or modified for each REST request.

URI Definition

Method

URI and Fields

GET




/iap/sev/{schedule}

Retrieves all schedules that the current user can read.

Parameter

schedule                     Can be specified as a Schedule name, an asterisk, or a regular expression.                          
See Query and Path Parameters below.

Query Parameters

The following optional parameters can be used in addition to those listed in Query Parameters

customerId                 (Optional) ID of the customer who owns the schedules to be obtained.                                  
start(Optional) Start date of the Schedule.
end(Optional)  End date of the Schedule.

Success Response

Collection of Schedules.

Example

GET Example /iap/sev/{schedule}
https://localhost/iap/sev/*
https://localhost/iap/sev/*+name=+^lamp


RESPONSE
[
    {
        "id": 233,
        "name": "event",
        "customerId": 32,
        "priority": 17,
        "start": "2020-03-19",
        "end": "2020-03-19",
        "repeat": null,
        "weekly": null,
        "datapoints": [
            "1/lon/1/LightSensor/2/nciLowLightAlarm",
            "1/lon/1/LightSensor/2/nvoLuxLevel"
        ],
        "tags": [
        ],
        "stagger": 0,
        "color": "#EEEEEE",
        "metadata": {
            "datapoints": [
                {
                    "blockName": "LightSensor",
                    "blockIndex": "2",
                    "deviceName": "device",
                    "dpQualifier": "1/lon/1/LightSensor/2/nciLowLightAlarm",
                    "datapointName": "nciLowLightAlarm"
                },
                {
                    "blockName": "LightSensor",
                    "blockIndex": "2",
                    "deviceName": "device",
                    "dpQualifier": "1/lon/1/LightSensor/2/nvoLuxLevel",
                    "datapointName": "nvoLuxLevel"
                }
            ],
            "targetType": "datapoints",
            "endDateType": "DATE",
            "endingOffset": {
                "isNegative": false
            },
            "repeatOption": "NO_REPEAT",
            "startingOffset": {
                "isNegative": false
            },
            "endingOffsetType": "LOCAL_TIME",
            "startingOffsetType": "LOCAL_TIME"
        },
        "startingDate": "2020-03-19",
        "startingTime": "04:00",
        "endingDate": "2020-03-19",
        "endingTime": "05:00",
        "exceptions": [
            {
                "date": {
                    "ot": "date:single",
                    "day": 19,
                    "year": 2020,
                    "month": 3
                },
                "prio": 17,
                "events": {
                    "04:00": "High",
                    "05:00": null
                }
            }
        ],
        "presetName": "High"
    }
]

/iap/sev/{schedule}/count

Returns the number of schedules that the current user can read.

Parameter

schedule                     Can be specified as a schedule name, an asterisk, or a regular expression.                           
See Query and Path Parameters below.

Query Parameters

The following optional parameters can be used in addition to those listed in Query Parameters

customerId                    ID of the customer who owns the schedules to be obtained.                               
startStart date of the schedule.
endEnd date of the schedule.

Success Response

Count of schedule that current user is permitted to read.

Example

GET Example /iap/sev/{schedule}/count
https://localhost/iap/sev/*/count
https://localhost/iap/sev/*+name=+^lamp/count

RESPONSE
{
    "value": 12
}

POST


 /iap/sev

Creates a new schedule with the specified properties. Only a single event can be created at a time.

Typically you will create events for the entire day for a datapoint.  You can create an all day event at one priority (say priority 16) and add one or more other events at a higher priority (say priority 15). In this way you know what value a datapoint is supposed to be unless someone or another process relinquishes the priority or issues a request with the same or higher priority.

Query Parameters

The following optional parameter can be used in addition to those listed in Query Parameters

customerId               ID of the customer who owns the schedules to be obtained.

Request Payload

The request payload must contain the ID of the customer owning the schedules to be created and the properties of the schedule to be created.

Success Response

Successfully created Schedule.

Example

Create Daily Event (two datapoints)
POST	https://10.0.0.113/iap/sev?customerId=33

REQUEST PAYLOAD
{
	"name":"Switch_10AM",
	"color":"#70BF41",
	"customerId":33,
	"priority":"15",
	"stagger":0,
	"tags":[],
	"start":"2022-02-15",
	"startingDate":"2022-02-15",
	"endingDate":"2022-02-15",
	"startingTime":"10:00",
	"endingTime":"11:00",
	"datapoints":[
		"17qam88/lon/3/Switch/0/nviSwitchFb",
		"17qam88/lon/3/Switch/1/nviSwitchFb"
	],
	"datapointTypeRef":"SNVT_switch",
	"localizedValue":{
		"value":70,
		"state":1
	},
	"value":null,
	"repeat":{
		"weekday":8
	}
}

RESPONSE
{
	"id":2631,
	"name":"Switch_10AM",
	"customerId":33,
	"priority":15,
	"start":"2022-02-15",
	"repeat":{"weekday":8},
	"weekly":{
		"8":{
			"10:00":{
				"value":70,
				"state":1
			},
			"11:00":null
		}
	},
		"datapoints":[
			"17qam88/lon/3/Switch/0/nviSwitchFb",
			"17qam88/lon/3/Switch/1/nviSwitchFb"
		],
	"tags":[],
	"stagger":0,
	"color":"#70BF41",
	"metadata":{
		"repeatOption":"DAILY",
		"datapoints":[
			{
				"deviceName":"MS-01",
				"blockName":"Switch",
				"blockIndex":1,
				"dpQualifier":"17qam88/lon/3/Switch/1/nviSwitchFb",
				"datapointName":"nviSwitchFb"
			},
			{
				"deviceName":"MS-01",
				"blockName":"Switch",
				"blockIndex":0,
				"dpQualifier":"17qam88/lon/3/Switch/0/nviSwitchFb",
				"datapointName":"nviSwitchFb"
				}
		],
		"targetType":"datapoints",
		"startingOffset":{
			"isNegative":false
		},
		"startingOffsetType":"LOCAL_TIME",
		"endingOffset":{
			"isNegative":false
		},
		"endingOffsetType":"LOCAL_TIME",
		"endDateType":"NONE"
		},
	"datapointTypeRef":"SNVT_switch",
	"startingDate":"2022-02-15",
	"startingTime":"10:00",
	"endingDate":"2022-02-15",
	"endingTime":"11:00",
	"exceptions":null,
	"value":{
		"value":70,
		"state":1
	},
	"localizedValue":{
		"value":70,
		"state":1
	}
}
Create One Time event
POST https://10.0.0.113/iap/sev?customerId=33


REQUEST PAYLOAD
{
	"name":"nviLamp1",
	"color":"#EC5D57",
	"customerId":33,
	"priority":17,
	"stagger":0,
	"tags":[],
	"start":"2022-02-15",
	"startingDate":"2022-02-15",
	"endingDate":"2022-02-15",
	"startingTime":"10:00",
	"endingTime":"11:00",
	"datapoints":[
		"17qam88/lon/3/Lamp/1/nviLamp"
	],
	"datapointTypeRef":"SNVT_switch",
	"localizedValue":{
		"value":20,
		"state":1
	},
	"value":null,
	"repeat":null,
	"end":"2022-02-15"
}
Create All Day (24 hour) event
POST	https://10.0.0.113/iap/sev?customerId=33


REQUEST PAYLOAD
{
	"name":"nviLamp0_All_day",
	"color":"#B36AE2",
	"customerId":33,
	"priority":"16",
	"stagger":0,
	"tags":[],
	"start":"2022-02-15",
	"startingDate":"2022-02-15",
	"startingTime":"00:00",
	"endingDate":"2022-02-15",
	"metadata":{
		"allDay":true
	},
	"datapoints":[
		"17qam88/lon/3/Lamp/0/nviLamp"
	],
	"datapointTypeRef":"SNVT_switch",
	"localizedValue":{
		"value":60,
		"state":1
	},
	"value":null,
	"repeat":null,
	"end":"2022-02-15"
}
Create Weekend event
POST	https://10.0.0.113/iap/sev?customerId=33


REQUEST PAYLOAD
{
	"name":"Lamp_weekend_9AM_endDate",
	"color":"#0365C0",
	"customerId":33,
	"priority":"12",
	"stagger":0,
	"tags":[],
	"start":"2022-02-16",
	"startingDate":"2022-02-16",
	"endingDate":"2022-02-16",
	"startingTime":"11:00",
	"endingTime":"12:00",
	"datapoints":[
		"17qam88/lon/3/Lamp/0/nviLamp"
	],
	"datapointTypeRef":"SNVT_switch",
	"localizedValue":{
		"value":55,
		"state":1
	},
	"value":null,
	"repeat":{
		"weekday":10
	},
	"end":"2022-06-30"
}
Create Every Thursday Event Using Presets
POST	https://10.0.0.113/iap/sev?customerId=33


REQUEST PAYLOAD
{
	"name":"Thur_ON_0800",
	"color":"#70BF41",
	"customerId":33,
	"priority":17,
	"stagger":0,
	"tags":[],
	"start":"2022-02-15",
	"startingDate":"2022-02-15",
	"endingDate":"2022-02-15",
	"startingTime":"08:00",
	"endingTime":"08:30",
	"datapoints":[
		"17qam88/lon/2/Digital Output/0/nviDO",
		"17qam88/modbus/1/DO/0/DO_1"
	],
	"presetName":"on",
	"value":null,
	"repeat":{
		"weekday":4
	}
}
Create Daily Event Using Sunrise and Sunset Times
POST	https://10.0.0.113/iap/sev?customerId=33


REQUEST PAYLOAD
{
	"name":"DayTime_Lamp_Off",
	"color":"#DCBD23",
	"customerId":33,
	"priority":"12",
	"stagger":0,
	"tags":[],
	"start":"2022-03-11",
	"startingDate":"2022-03-11",
	"endingDate":"2022-03-11",
	"startingTime":"R00:15",
	"endingTime":"00:15S",
	"datapoints":[
		"17qehie/lon/61/Lamp/0/nviLamp"
	],
	"datapointTypeRef":"SNVT_switch",
	"localizedValue":{
		"value":0,"state":0
	},
	"value":null,
	"repeat":{
		"weekday":8
	}
}
One time event running Wednesday through Friday (2023-05-31 through 2023-06-02)
Set "start" is Wednesday (2023-05-31) and "end" is Friday (2023-06-02).  "startingDate" and "endingDate" should be same as "start".

POST	https://10.0.0.113/iap/sev?customerId=53

{
	"desc":"One time Wed-Fri",
	"timespec":"local",
	"prio":16,
	"effective":
	{
		"ot":"date:range",
		"start":
		{
			"ot":"date:single",
			"year":2023,
			"month":5,
			"day":31
		},
		"end":
		{
			"ot":"date:single",
			"year":2023,
			"month":6,
			"day":2
		}
	},
	"weekly":
	{
		"8":
		{
			"08:00":
			{
				"value":16,
				"state":1
			},
			"09:00":null
		}
	},
	"dp":
	[
		"~/dev/lon/4/if/Lamp/0/nviLamp"
	],
	"stagger":0,
	"exceptions":null,
	"mru":"2023-05-30 14:37:17.436 UTC"
}
PUT



/iap/sev/{id}

Updates an existing schedule with the specified properties.

Parameters

Id                          ID of schedule to be updated.                                                                                        

Request Payload

The request payload must contain the properties to be used to update the schedule.

Success Response

Successfully updated schedule.

Example

id
https://localhost/iap/sev/1


REQUEST PAYLOAD
{
  "customerId": 31,
  "tags": [
  ],
  "stagger": 0,
  "presetName": "High",
  "priority": 17,
  "color": "#EEEEEE",
  "name": "event2",
  "datapoints": [
    "1/lon/1/LightSensor/2/nciLowLightAlarm",
    "1/lon/1/LightSensor/2/nvoLuxLevel"
  ],
  "startingTime": "20:30",
  "endingTime": "22:30",
  "start": "2020-03-12",
  "end": "2020-03-12",
  "startingDate": "2020-03-12",
  "endingDate": "2020-03-12"
}


RESPONSE
{
    "id": 360,
    "name": "event2",
    "customerId": 32,
    "priority": 17,
    "start": "2020-03-12",
    "end": "2020-03-12",
    "repeat": null,
    "weekly": null,
    "datapoints": [
        "1/lon/1/LightSensor/2/nciLowLightAlarm",
        "1/lon/1/LightSensor/2/nvoLuxLevel"
    ],
    "tags": [
    ],
    "stagger": 0,
    "color": "#EEEEEE",
    "metadata": {
        "repeatOption": "NO_REPEAT",
        "datapoints": [
            {
                "deviceName": "device",
                "blockName": "LightSensor",
                "blockIndex": "2",
                "dpQualifier": "1/lon/1/LightSensor/2/nciLowLightAlarm",
                "datapointName": "nciLowLightAlarm"
            },
            {
                "deviceName": "device",
                "blockName": "LightSensor",
                "blockIndex": "2",
                "dpQualifier": "1/lon/1/LightSensor/2/nvoLuxLevel",
                "datapointName": "nvoLuxLevel"
            }
        ],
        "targetType": "datapoints",
        "startingOffset": {
            "isNegative": false
        },
        "startingOffsetType": "LOCAL_TIME",
        "endingOffset": {
            "isNegative": false
        },
        "endingOffsetType": "LOCAL_TIME",
        "endDateType": "DATE"
    },
    "startingDate": "2020-03-12",
    "startingTime": "20:30",
    "endingDate": "2020-03-12",
    "endingTime": "22:30",
    "exceptions": [
        {
            "date": {
                "ot": "date:single",
                "year": 2020,
                "month": 3,
                "day": 12
            },
            "events": {
                "20:30": "High",
                "22:30": null
            },
            "prio": 17
        }
    ],
    "presetName": "High"
}
/iap/sev/delete

Deletes the schedules with the specified IDs.  If no Ids are specified, deletes all schedules.

Request Payload

The request payload must contain the IDs of the schedules to be deleted.

Success Response

Response code 200 in case of success or an error code otherwise.

Example

PUT Example /iap/sev/delete
https://localhost/iap/sev/delete


RESPONSE
Response 200

Query and Path Parameters

Optional query parameters can be used with your REST request.  Specifying queries is described under Queries and Parameters.

{schedule} Path Parameters

The following list describes the optional path parameters for the Schedule Service endpoints.

Path ParameterDescription
deviceFilters for schedules created for a device with the specified name
geozoneFilters for schedules created for devices located in geozone with the specified name
groupFilters for schedules created for devices that belong to group with the specified name
idFilters for schedules with the specified schedule ID
nameFilters for schedules with the specified name
priorityFilters for schedules with the specified priority
scIdFilters for schedules created for devices connected to Edge Server with the specified ID
scNameFilters for schedules created for devices connected to Edge Server with the specified name
tagFilters for schedules with the specified tag
zoneFilters for schedules created for devices located in zone with the specified name