Rules
Introduction
Rules determine how an access control system will respond in a given scenario. Rules are divided into 4 categories: holder rules, group rules, auto open rules, and system event rules.
The rule object
{
"id": "584e6c47-a7cd-44f1-aba0-0453858dfd41",
"type": "access",
"allow": true,
"authenticationPolicy": "cardOrPin",
"devices": [
{
"id": "35347d04-a99c-4a58-ab32-1317b832507a",
"name": "Test Device",
"cloudNode": {
"id": "7d829ff4-53e8-4d76-8762-1022ccdeae39",
"name": "Test Cloud Node",
"serialNumber": "1234ABC"
}
}
],
"startTime": "09:00",
"stopTime": "17:00",
"recurring": ["Mon", "Tue", "Wed", "Thu", "Fri"]
}
| Property | Type | Description |
|---|---|---|
id | String | The rule ID. |
name | String | The rule name. |
partition | String | The partition ID. |
type | String | The rule type. Possible values include access, antiPassback, autoOpen, elevator, event, and systemEvent. |
allow | Boolean | Whether access will be granted or denied. |
authenticationPolicy | String | The authentication policy for this rule. Possible values include cardOnly, pinOnly, cardOrPin, and cardAndPin (for two-factor authentication). Note that card refers to all types of credentials (not just cards). |
devices | Object[] | An array of devices associated with this rule. |
devices.id | String | The device ID. |
devices.name | String | The device name. |
devices.cloudNode.id | String | The ID of the cloud node associated with the device. |
devices.cloudNode.name | String | The name of the cloud node associated with the device. |
devices.cloudNode.serialNumber | String | The serial number of the cloud node associated with the device. |
startTime | String | The rule start time using 24-hour HH:MM format. |
stopTime | String | The rule stop time using 24-hour HH:MM format. |
recurring | String[] | The days of the week this rule will be active. Possible values include Mon, Tue, Wed, Thu, Fri, Sat, and Sun. |
singleDate | String | The specific date this rule will be active. This is formatted as YYYY-MM-DD. |
floorGroups | Object[] | An array of floor group objects representing the floor groups associated with this rule. Note that only the id and name properties are included. |
triggerType | String | The event rule trigger type. This only applies if type is set to event or systemEvent. When type is set to event, possible values include alwaysOnValidCard, onDoubleSwipeAllow, onDuress, onQuadrupleSwipeAllow, onTripleSwipeAllow, whenAllowed, whenDeniedExplicit, and whenDeniedNoRules. When type is set to systemEvent, possible values include allPropCleared, onAnyDuress, onBatteryConnect, onBatteryDisconnect, onCardNotFound, onCardSwipe, onCircuitBreakerOff, onCircuitBreakerOn, onComLoss, onComLossCleared, onDoorClose, onDoorForced, onDoorOpen, onDoorPropped, onInputPowerLoss, onInputPowerRecovery, onJammed, onJammedClear, onLowPowerModeOff, onLowPowerModeOn, onOverCurrentCleared, onOverCurrentDetected, onPartialConnectivityCleared, onPartialConnectivityDetected, onPropCleared, onRequest, onRexClose, onRexOpen, onUnderVoltageCleared, and onUnderVoltageDetected. |
action | String | The event rule action. This only applies if type is set to event or systemEvent. Possible values include close, delayClose, delayOpen, doNotDisturb, forceClose, forceOpen, forceToggle, lockdownOff, lockdownOn, open, openClose, piezoOff, piezoOn, pushNotification, and sendEmail. |
emailTemplate | Object | The email template. This only applies if action is set to sendEmail. |
emailTemplate.to | String[] | An array of recipient email addresses. |
emailTemplate.subject | String | The email template subject. |
emailTemplate.body | String | The email template body. This may include email template variables. |
recipients | String[] | An array of user IDs. These users will receive push notifications when the rule is triggered. This only applies if action is set to pushNotification. |
onTime | Integer | The duration (in tenths of a second) of each tone in the piezo tone sequence. This only applies if action is set to piezoOn. |
offTime | Integer | The duration (in tenths of a second) of silence between each tone in the piezo tone sequence. This only applies if action is set to piezoOn. |
count | Integer | The number of times the piezo tone sequence is repeated. This only applies if action is set to piezoOn. |
dwell | String | The dwell time in HH:MM:SS format. This only applies if action is set to openClose. |
delay | String | The action delay in HH:MM:SS format. This only applies if action is set to delayOpen, delayClose, or openClose. |
sourceDevices | Object[] | An array of devices associated with an anti-passback or system event rule. For anti-passback rules, these represent the entry devices. |
exitDevices | Object[] | An array of devices associated with an anti-passback rule. This only applies if type is set to antiPassback. |
expiration | Integer | The duration (in seconds) of an anti-passback rule. This only applies if type is set to antiPassback. |
target | String | Whether the target devices of a system event rule are the same as the source devices or individually selected. This only applies if type is set to systemEvent. Possible values include source and selected. |
targetDevices | Object[] | An array of devices associated with a system event rule. This only applies if target is set to selected. |
Anti-passback rules
In locations where it makes sense to have both entrance and exit readers, it may also make sense to enforce anti-passback rules. For example, once users enter a parking garage, they should not be able to enter again until after they've exited. This prevents users from passing credentials back to other users for unauthorized reuse (hence the name "anti-passback").
Email template variables
The emailTemplate.body property may include the following email template variables.
| Variable | Description |
|---|---|
<%time%> | The time of the event. Example: 2023-07-11 17:39:49 |
<%logname%> | The holder's name (if applicable). Example: John Wiegand |
<%logevent%> | A short description of the event trigger. Example: Credentials Input |
<%logdoor%> | The name of the device associated with the event. Example: Test Device |
<%logresult%> | A short description of the result. Example: Access Allowed |
<%loginfo%> | A long description of the event. Example: Person "John Wiegand" has requested access to the device "Test Device". Access allowed. Person used card for requesting access. |
<%logcardno%> | The credential number (if applicable). Example: 1234567 |
Holder Rules
Create a holder rule
Request
POST https://systems.pdk.io/{{system_id}}/holders/{{holder_id}}/rules HTTP/1.1
Authorization: Bearer {{system_token}}
Content-Type: application/json
{
"type": "access",
"allow": true,
"devices": [
"35347d04-a99c-4a58-ab32-1317b832507a"
],
"authenticationPolicy": "cardOrPin",
"startTime": "09:00",
"stopTime": "17:00",
"recurring": [
"Mon",
"Tue",
"Wed",
"Thu",
"Fri"
]
}
| Parameter | Location | Type | Required | Description |
|---|---|---|---|---|
system_id | Path | String | Yes | The system ID. |
holder_id | Path | String | Yes | The holder ID. |
system_token | Header | String | Yes | A valid system token. |
type | Body | String | Yes | The rule type. Possible values include access, elevator, antiPassback and event. |
allow | Body | Boolean | Sometimes | Whether access should be granted or denied. This is required if type is set to access or antiPassback. |
devices | Body | String[] | Sometimes | The IDs of the devices associated with this rule. This is required if type is set to access. |
startTime | Body | String | Yes | The rule start time using 24-hour HH:MM format. |
stopTime | Body | String | Yes | The rule stop time using 24-hour HH:MM format. This must be greater than startTime. |
recurring | Body | String[] | Sometimes | The days of the week this rule should be active. Possible values include Mon, Tue, Wed, Thu, Fri, Sat, and Sun. This is required if singleDate is omitted. |
singleDate | Body | String | Sometimes | The specific date this rule should be active. This should be formatted as YYYY-MM-DD. Dates in the past are not allowed. This is required if recurring is omitted. |
authenticationPolicy | Body | String | Sometimes | The authentication policy for this rule. Possible values include cardOnly, pinOnly, cardOrPin, and cardAndPin (for two-factor authentication). Note that card refers to all types of credentials (not just cards). This is required if (1) type is set to elevator or (2) allow is set to true and type is set to access or event. The default value is cardOnly. |
floorGroups | Body | String[] | Sometimes | The IDs of the floor groups associated with this rule. This is required if type is set to elevator. |
name | Body | String | Sometimes | The event rule name. This is required if type is set to event. The maximum length is 70 characters. |
triggerType | Body | String | Sometimes | The event rule trigger type. This is required if type is set to event. Possible values include alwaysOnValidCard, onDoubleSwipeAllow, onDuress, onQuadrupleSwipeAllow, onTripleSwipeAllow, whenAllowed, whenDeniedExplicit, and whenDeniedNoRules. |
action | Body | String | Sometimes | The event rule action. This is required if type is set to event. Possible values include close, delayClose, delayOpen, doNotDisturb, forceClose, forceOpen, forceToggle, lockdownOff, lockdownOn, open, openClose, piezoOff, piezoOn, pushNotification, and sendEmail. |
emailTemplate | Body | Object | Sometimes | The email template. This is required if action is set to sendEmail. |
emailTemplate.to | Body | String[] | Yes | An array of 1–30 unique recipient email addresses. Example: ["john@example.com"] |
emailTemplate.subject | Body | String | Yes | The email template subject. The maximum length is 255 characters. |
emailTemplate.body | Body | String | Yes | The email template body. The maximum length is 2048 characters. Email template variables may be used for customization. |
recipients | Body | String[] | Sometimes | An array of 1–30 user IDs. These users will receive push notifications when the rule is triggered. This is required if action is set to pushNotification. |
onTime | Body | Integer | No | The duration (in tenths of a second) of each tone in the piezo tone sequence. This only applies if action is set to piezoOn. The minimum value is 1 and the maximum value is 255. |
offTime | Body | Integer | No | The duration (in tenths of a second) of silence between each tone in the piezo tone sequence. This only applies if action is set to piezoOn. The minimum value is 0 and the maximum value is 255. |
count | Body | Integer | No | The number of times the piezo tone sequence is repeated. This only applies if action is set to piezoOn. The minimum value is 0 and the maximum value is 255. |
dwell | Body | String | No | The dwell time in HH:MM:SS format. This only applies if action is set to openClose. The minimum value is 00:00:01. |
delay | Body | String | No | The action delay in HH:MM:SS format. This only applies if action is set to delayOpen, delayClose, or openClose. The minimum value is 00:00:01. |
sourceDevices | Body | String[] | Sometimes | The IDs of the source devices associated with an anti-passback or event rule. This is required if type is set to antiPassback or event. For anti-passback rules, these represent the entry devices. |
exitDevices | Body | String[] | Sometimes | The IDs of the exit devices associated with an anti-passback rule. This is required if type is set to antiPassback. |
expiration | Body | Integer or Null | Sometimes | The duration (in seconds) of an anti-passback rule. This is required if type is set to antiPassback. The maximum value is 31536000 (1 year) or null (no expiration). |
target | Body | String | Sometimes | Whether the target devices of an event rule should be the same as the source devices or individually selected. This is required if type is set to event. Possible values include source and selected. |
targetDevices | Body | String[] | Sometimes | The IDs of the target devices associated with an event rule. This is required if target is set to selected. |
Response
The response contains the ID of the newly created rule object.
HTTP/1.1 201 Created
Content-Type: application/json
{
"id": "584e6c47-a7cd-44f1-aba0-0453858dfd41"
}
Retrieve a holder rule
Request
GET https://systems.pdk.io/{{system_id}}/holders/{{holder_id}}/rules/{{rule_id}} HTTP/1.1
Authorization: Bearer {{system_token}}
| Parameter | Location | Type | Required | Description |
|---|---|---|---|---|
system_id | Path | String | Yes | The system ID. |
holder_id | Path | String | Yes | The holder ID. |
rule_id | Path | String | Yes | The rule ID. |
system_token | Header | String | Yes | A valid system token. |
Response
The response contains a rule object.
HTTP/1.1 200 OK
Content-Type: application/json
{
"id": "584e6c47-a7cd-44f1-aba0-0453858dfd41",
"type": "access",
"allow": true,
"authenticationPolicy": "cardOrPin",
"devices": [
{
"id": "35347d04-a99c-4a58-ab32-1317b832507a",
"name": "Test Device",
"cloudNode": {
"id": "7d829ff4-53e8-4d76-8762-1022ccdeae39",
"name": "Test Cloud Node",
"serialNumber": "1234ABC"
}
}
],
"startTime": "09:00",
"stopTime": "17:00",
"recurring": [
"Mon",
"Tue",
"Wed",
"Thu",
"Fri"
]
}
Update a holder rule
Request
PUT https://systems.pdk.io/{{system_id}}/holders/{{holder_id}}/rules/{{rule_id}} HTTP/1.1
Authorization: Bearer {{system_token}}
Content-Type: application/json
{
"type": "access",
"allow": true,
"devices": [
"35347d04-a99c-4a58-ab32-1317b832507a"
],
"authenticationPolicy": "cardOrPin",
"startTime": "09:00",
"stopTime": "17:00",
"recurring": [
"Mon",
"Tue",
"Wed",
"Thu",
"Fri"
]
}
| Parameter | Location | Type | Required | Description |
|---|---|---|---|---|
system_id | Path | String | Yes | The system ID. |
holder_id | Path | String | Yes | The holder ID. |
rule_id | Path | String | Yes | The rule ID. |
system_token | Header | String | Yes | A valid system token. |
type | Body | String | Yes | The rule type. This can't be changed and must match the value that was used when the rule was created. Possible values include access, antiPassback, elevator, and event. |
allow | Body | Boolean | Sometimes | Whether access should be granted or denied. This is required if type is set to access or antiPassback. |
devices | Body | String[] | Sometimes | The IDs of the devices associated with this rule. This is required if type is set to access. |
startTime | Body | String | Yes | The rule start time using 24-hour HH:MM format. |
stopTime | Body | String | Yes | The rule stop time using 24-hour HH:MM format. This must be greater than startTime. |
recurring | Body | String[] | Sometimes | The days of the week this rule should be active. Possible values include Mon, Tue, Wed, Thu, Fri, Sat, and Sun. This is required if singleDate is omitted. |
singleDate | Body | String | Sometimes | The specific date this rule should be active. This should be formatted as YYYY-MM-DD. Dates in the past are not allowed. This is required if recurring is omitted. |
authenticationPolicy | Body | String | No | The authentication policy for this rule. Possible values include cardOnly, pinOnly, cardOrPin, and cardAndPin (for two-factor authentication). Note that card refers to all types of credentials (not just cards). The default value is cardOnly. |
floorGroups | Body | String[] | Sometimes | The IDs of the floor groups associated with this rule. This is required if type is set to elevator. |
name | Body | String | Sometimes | The event rule name. This is required if type is set to event. The maximum length is 70 characters. |
triggerType | Body | String | Sometimes | The event rule trigger type. This is required if type is set to event. Possible values include alwaysOnValidCard, onDoubleSwipeAllow, onDuress, onQuadrupleSwipeAllow, onTripleSwipeAllow, whenAllowed, whenDeniedExplicit, and whenDeniedNoRules. |
action | Body | String | Sometimes | The event rule action. This is required if type is set to event. Possible values include close, delayClose, delayOpen, doNotDisturb, forceClose, forceOpen, forceToggle, lockdownOff, lockdownOn, open, openClose, piezoOff, piezoOn, pushNotification, and sendEmail. |
emailTemplate | Body | Object | Sometimes | The email template. This is required if action is set to sendEmail. |
emailTemplate.to | Body | String[] | Yes | An array of 1–30 unique recipient email addresses. Example: ["john@example.com"] |
emailTemplate.subject | Body | String | Yes | The email template subject. The maximum length is 255 characters. |
emailTemplate.body | Body | String | Yes | The email template body. The maximum length is 2048 characters. Email template variables may be used for customization. |
recipients | Body | String[] | Sometimes | An array of 1–30 user IDs. These users will receive push notifications when the rule is triggered. This is required if action is set to pushNotification. |
onTime | Body | Integer | No | The duration (in tenths of a second) of each tone in the piezo tone sequence. This only applies if action is set to piezoOn. The minimum value is 1 and the maximum value is 255. |
offTime | Body | Integer | No | The duration (in tenths of a second) of silence between each tone in the piezo tone sequence. This only applies if action is set to piezoOn. The minimum value is 0 and the maximum value is 255. |
count | Body | Integer | No | The number of times the piezo tone sequence is repeated. This only applies if action is set to piezoOn. The minimum value is 0 and the maximum value is 255. |
dwell | Body | String | No | The dwell time in HH:MM:SS format. This only applies if action is set to openClose. The minimum value is 00:00:01. |
delay | Body | String | No | The action delay in HH:MM:SS format. This only applies if action is set to delayOpen, delayClose, or openClose. The minimum value is 00:00:01. |
sourceDevices | Body | String[] | Sometimes | The IDs of the source devices associated with an anti-passback or event rule. This is required if type is set to antiPassback or event. For anti-passback rules, these represent the entry devices. |
exitDevices | Body | String[] | Sometimes | The IDs of the exit devices associated with an anti-passback rule. This is required if type is set to antiPassback. |
expiration | Body | Integer or Null | Sometimes | The duration (in seconds) of an anti-passback rule. This is required if type is set to antiPassback. The maximum value is 31536000 (1 year) or null (no expiration). |
target | Body | String | Sometimes | Whether the target devices of an event rule should be the same as the source devices or individually selected. This is required if type is set to event. Possible values include source and selected. |
targetDevices | Body | String[] | Sometimes | The IDs of the target devices associated with an event rule. This is required if target is set to selected. |
Response
HTTP/1.1 204 No Content
Delete a holder rule
Request
DELETE https://systems.pdk.io/{{system_id}}/holders/{{holder_id}}/rules/{{rule_id}} HTTP/1.1
Authorization: Bearer {{system_token}}
| Parameter | Location | Type | Required | Description |
|---|---|---|---|---|
system_id | Path | String | Yes | The system ID. |
holder_id | Path | String | Yes | The holder ID. |
rule_id | Path | String | Yes | The rule ID. |
system_token | Header | String | Yes | A valid system token. |
Response
HTTP/1.1 204 No Content
List all holder rules
Request
GET https://systems.pdk.io/{{system_id}}/holders/{{holder_id}}/rules HTTP/1.1
Authorization: Bearer {{system_token}}
| Parameter | Location | Type | Required | Description |
|---|---|---|---|---|
system_id | Path | String | Yes | The system ID. |
holder_id | Path | String | Yes | The holder ID. |
sort | Query | String | No | The sort order for results. Possible values include asc and desc. The default value is asc. |
page | Query | Integer | No | The zero-based page number used for pagination. The default value is 0. |
per_page | Query | Integer | No | The number of items per page used for pagination. The default value is 10 and the maximum value is 1000. |
system_token | Header | String | Yes | A valid system token. |
Response
The response contains an array of rule objects.
HTTP/1.1 200 OK
Content-Type: application/json
[
{
"id": "584e6c47-a7cd-44f1-aba0-0453858dfd41",
"type": "access",
"allow": true,
"authenticationPolicy": "cardOrPin",
"devices": [
{
"id": "35347d04-a99c-4a58-ab32-1317b832507a",
"name": "Test Device",
"cloudNode": {
"id": "7d829ff4-53e8-4d76-8762-1022ccdeae39",
"name": "Test Cloud Node",
"serialNumber": "1234ABC"
}
}
],
"startTime": "09:00",
"stopTime": "17:00",
"recurring": [
"Mon",
"Tue",
"Wed",
"Thu",
"Fri"
]
}
]
List all anti-passback restrictions
This endpoint allows you to list all anti-passback restrictions for a holder.
Request
GET https://systems.pdk.io/{{system_id}}/holders/{{holder_id}}/restrictions HTTP/1.1
Authorization: Bearer {{system_token}}
| Parameter | Location | Type | Required | Description |
|---|---|---|---|---|
system_id | Path | String | Yes | The system ID. |
holder_id | Path | String | Yes | The holder ID. |
system_token | Header | String | Yes | A valid system token. |
Response
The response contains an array of anti-passback restriction objects.
HTTP/1.1 200 OK
Content-Type: application/json
[
{
"ruleId": "1bb6347f-5928-4806-b277-6d0d8424af7a",
"allow": false,
"sourceDevices": [
{
"id": "2bc698fe-a964-4bb0-b505-2369acf49262",
"name": "Test Device 1"
}
],
"exitDevices": [
{
"id": "16f44de1-01cb-43f1-af50-1d2667686d58",
"name": "Test Device 2"
}
],
"expiresAt": "2023-07-18T17:15:51.658Z"
}
]
| Properties | Type | Description |
|---|---|---|
ruleId | String | The rule ID. |
allow | Boolean | Whether access will be granted or denied. |
sourceDevices | Object[] | An array of device objects representing the entry devices associated with the anti-passback rule. |
exitDevices | Object[] | An array of device objects representing the exit devices associated with the anti-passback rule. |
expiresAt | String | An ISO 8601 timestamp representing the time at which the anti-passback restriction expires. |
Clear an anti-passback restriction
This endpoint allows you to clear a specific anti-passback restriction for a holder.
Request
POST https://systems.pdk.io/{{system_id}}/holders/{{holder_id}}/restrictions/clear HTTP/1.1
Authorization: Bearer {{system_token}}
Content-Type: application/json
{
"ruleId": "1bb6347f-5928-4806-b277-6d0d8424af7a"
}
| Parameter | Location | Type | Required | Description |
|---|---|---|---|---|
system_id | Path | String | Yes | The system ID. |
holder_id | Path | String | Yes | The holder ID. |
system_token | Header | String | Yes | A valid system token. |
ruleId | Body | String | Yes | The rule ID. |
Response
HTTP/1.1 204 No Content
Clear all anti-passback restrictions
This endpoint allows you to clear all anti-passback restrictions for a holder.
Request
POST https://systems.pdk.io/{{system_id}}/holders/{{holder_id}}/restrictions/clear-all HTTP/1.1
Authorization: Bearer {{system_token}}
| Parameter | Location | Type | Required | Description |
|---|---|---|---|---|
system_id | Path | String | Yes | The system ID. |
holder_id | Path | String | Yes | The holder ID. |
system_token | Header | String | Yes | A valid system token. |
Response
HTTP/1.1 204 No Content
Group Rules
Create a group rule
Request
POST https://systems.pdk.io/{{system_id}}/groups/{{group_id}}/rules HTTP/1.1
Authorization: Bearer {{system_token}}
Content-Type: application/json
{
"type": "access",
"allow": true,
"devices": [
"35347d04-a99c-4a58-ab32-1317b832507a"
],
"authenticationPolicy": "cardOrPin",
"startTime": "09:00",
"stopTime": "17:00",
"recurring": [
"Mon",
"Tue",
"Wed",
"Thu",
"Fri"
]
}
| Parameter | Location | Type | Required | Description |
|---|---|---|---|---|
system_id | Path | String | Yes | The system ID. |
group_id | Path | String | Yes | The group ID. |
system_token | Header | String | Yes | A valid system token. |
type | Body | String | Yes | The rule type. Possible values include access, antiPassback, elevator, and event. |
allow | Body | Boolean | Sometimes | Whether access should be granted or denied. This is required if type is set to access or antiPassback. |
devices | Body | String[] | Sometimes | The IDs of the devices associated with this rule. This is required if type is set to access. |
startTime | Body | String | Yes | The rule start time using 24-hour HH:MM format. |
stopTime | Body | String | Yes | The rule stop time using 24-hour HH:MM format. This must be greater than startTime. |
recurring | Body | String[] | No | The days of the week this rule should be active. Possible values include Mon, Tue, Wed, Thu, Fri, Sat, and Sun. This is required if singleDate is omitted. |
singleDate | Body | String | No | The specific date this rule should be active. This should be formatted as YYYY-MM-DD. Dates in the past are not allowed. This is required if recurring is omitted. |
authenticationPolicy | Body | String | No | The authentication policy for this rule. Possible values include cardOnly, pinOnly, cardOrPin, and cardAndPin (for two-factor authentication). Note that card refers to all types of credentials (not just cards). The default value is cardOnly. |
floorGroups | Body | String[] | Sometimes | The IDs of the floor groups associated with this rule. This is required if type is set to elevator. |
name | Body | String | Sometimes | The event rule name. This is required if type is set to event. The maximum length is 70 characters. |
triggerType | Body | String | Sometimes | The event rule trigger type. This is required if type is set to event. Possible values include alwaysOnValidCard, onDoubleSwipeAllow, onDuress, onQuadrupleSwipeAllow, onTripleSwipeAllow, whenAllowed, whenDeniedExplicit, and whenDeniedNoRules. |
action | Body | String | Sometimes | The event rule action. This is required if type is set to event. Possible values include close, delayClose, delayOpen, doNotDisturb, forceClose, forceOpen, forceToggle, lockdownOff, lockdownOn, open, openClose, piezoOff, piezoOn, pushNotification, and sendEmail. |
emailTemplate | Body | Object | Sometimes | The email template. This is required if action is set to sendEmail. |
emailTemplate.to | Body | String[] | Yes | An array of 1–30 unique recipient email addresses. Example: ["john@example.com"] |
emailTemplate.subject | Body | String | Yes | The email template subject. The maximum length is 255 characters. |
emailTemplate.body | Body | String | Yes | The email template body. The maximum length is 2048 characters. Email template variables may be used for customization. |
recipients | Body | String[] | Sometimes | An array of 1–30 user IDs. These users will receive push notifications when the rule is triggered. This is required if action is set to pushNotification. |
onTime | Body | Integer | No | The duration (in tenths of a second) of each tone in the piezo tone sequence. This only applies if action is set to piezoOn. The minimum value is 1 and the maximum value is 255. |
offTime | Body | Integer | No | The duration (in tenths of a second) of silence between each tone in the piezo tone sequence. This only applies if action is set to piezoOn. The minimum value is 0 and the maximum value is 255. |
count | Body | Integer | No | The number of times the piezo tone sequence is repeated. This only applies if action is set to piezoOn. The minimum value is 0 and the maximum value is 255. |
dwell | Body | String | No | The dwell time in HH:MM:SS format. This only applies if action is set to openClose. The minimum value is 00:00:01. |
delay | Body | String | No | The action delay in HH:MM:SS format. This only applies if action is set to delayOpen, delayClose, or openClose. The minimum value is 00:00:01. |
sourceDevices | Body | String[] | Sometimes | The IDs of the source devices associated with an anti-passback or event rule. This is required if type is set to antiPassback or event. For anti-passback rules, these represent the entry devices. |
exitDevices | Body | String[] | Sometimes | The IDs of the exit devices associated with an anti-passback rule. This is required if type is set to antiPassback. |
expiration | Body | Integer or Null | Sometimes | The duration (in seconds) of an anti-passback rule. This is required if type is set to antiPassback. The maximum value is 31536000 (1 year) or null (no expiration). |
target | Body | String | Sometimes | Whether the target devices of an event rule should be the same as the source devices or individually selected. This is required if type is set to event. Possible values include source and selected. |
targetDevices | Body | String[] | Sometimes | The IDs of the target devices associated with an event rule. This is required if target is set to selected. |
Response
The response contains the ID of the newly created rule object.
HTTP/1.1 201 Created
Content-Type: application/json
{
"id": "584e6c47-a7cd-44f1-aba0-0453858dfd41"
}
Retrieve a group rule
Request
GET https://systems.pdk.io/{{system_id}}/groups/{{group_id}}/rules/{{rule_id}} HTTP/1.1
Authorization: Bearer {{system_token}}
| Parameter | Location | Type | Required | Description |
|---|---|---|---|---|
system_id | Path | String | Yes | The system ID. |
group_id | Path | String | Yes | The group ID. |
rule_id | Path | String | Yes | The rule ID. |
system_token | Header | String | Yes | A valid system token. |
Response
The response contains a rule object.
HTTP/1.1 200 OK
Content-Type: application/json
{
"id": "584e6c47-a7cd-44f1-aba0-0453858dfd41",
"type": "access",
"allow": true,
"authenticationPolicy": "cardOrPin",
"devices": [
{
"id": "35347d04-a99c-4a58-ab32-1317b832507a",
"name": "Test Device",
"cloudNode": {
"id": "7d829ff4-53e8-4d76-8762-1022ccdeae39",
"name": "Test Cloud Node",
"serialNumber": "1234ABC"
}
}
],
"startTime": "09:00",
"stopTime": "17:00",
"recurring": [
"Mon",
"Tue",
"Wed",
"Thu",
"Fri"
]
}
Update a group rule
Request
PUT https://systems.pdk.io/{{system_id}}/groups/{{group_id}}/rules/{{rule_id}} HTTP/1.1
Authorization: Bearer {{system_token}}
Content-Type: application/json
{
"type": "access",
"allow": true,
"devices": [
"35347d04-a99c-4a58-ab32-1317b832507a"
],
"authenticationPolicy": "cardOrPin",
"startTime": "09:00",
"stopTime": "17:00",
"recurring": [
"Mon",
"Tue",
"Wed",
"Thu",
"Fri"
]
}
| Parameter | Location | Type | Required | Description |
|---|---|---|---|---|
system_id | Path | String | Yes | The system ID. |
group_id | Path | String | Yes | The group ID. |
rule_id | Path | String | Yes | The rule ID. |
system_token | Header | String | Yes | A valid system token. |
type | Body | String | Yes | The rule type. This can't be changed and must match the value that was used when the rule was created. Possible values include access, antiPassback, elevator, and event. |
allow | Body | Boolean | Sometimes | Whether access should be granted or denied. This is required if type is set to access or antiPassback. |
devices | Body | String[] | Sometimes | The IDs of the devices associated with this rule. This is required if type is set to access. |
startTime | Body | String | Yes | The rule start time using 24-hour HH:MM format. |
stopTime | Body | String | Yes | The rule stop time using 24-hour HH:MM format. This must be greater than startTime. |
recurring | Body | String[] | Sometimes | The days of the week this rule should be active. Possible values include Mon, Tue, Wed, Thu, Fri, Sat, and Sun. This is required if singleDate is omitted. |
singleDate | Body | String | Sometimes | The specific date this rule should be active. This should be formatted as YYYY-MM-DD. Dates in the past are not allowed. This is required if recurring is omitted. |
authenticationPolicy | Body | String | No | The authentication policy for this rule. Possible values include cardOnly, pinOnly, cardOrPin, and cardAndPin (for two-factor authentication). Note that card refers to all types of credentials (not just cards). The default value is cardOnly. |
floorGroups | Body | String[] | Sometimes | The IDs of the floor groups associated with this rule. This is required if type is set to elevator. |
name | Body | String | Sometimes | The event rule name. This is required if type is set to event. The maximum length is 70 characters. |
triggerType | Body | String | Sometimes | The event rule trigger type. This is required if type is set to event. Possible values include alwaysOnValidCard, onDoubleSwipeAllow, onDuress, onQuadrupleSwipeAllow, onTripleSwipeAllow, whenAllowed, whenDeniedExplicit, and whenDeniedNoRules. |
action | Body | String | Sometimes | The event rule action. This is required if type is set to event. Possible values include close, delayClose, delayOpen, doNotDisturb, forceClose, forceOpen, forceToggle, lockdownOff, lockdownOn, open, openClose, piezoOff, piezoOn, pushNotification, and sendEmail. |
emailTemplate | Body | Object | Sometimes | The email template. This is required if action is set to sendEmail. |
emailTemplate.to | Body | String[] | Yes | An array of 1–30 unique recipient email addresses. Example: ["john@example.com"] |
emailTemplate.subject | Body | String | Yes | The email template subject. The maximum length is 255 characters. |
emailTemplate.body | Body | String | Yes | The email template body. The maximum length is 2048 characters. Email template variables may be used for customization. |
recipients | Body | String[] | Sometimes | An array of 1–30 user IDs. These users will receive push notifications when the rule is triggered. This is required if action is set to pushNotification. |
onTime | Body | Integer | No | The duration (in tenths of a second) of each tone in the piezo tone sequence. This only applies if action is set to piezoOn. The minimum value is 1 and the maximum value is 255. |
offTime | Body | Integer | No | The duration (in tenths of a second) of silence between each tone in the piezo tone sequence. This only applies if action is set to piezoOn. The minimum value is 0 and the maximum value is 255. |
count | Body | Integer | No | The number of times the piezo tone sequence is repeated. This only applies if action is set to piezoOn. The minimum value is 0 and the maximum value is 255. |
dwell | Body | String | No | The dwell time in HH:MM:SS format. This only applies if action is set to openClose. The minimum value is 00:00:01. |
delay | Body | String | No | The action delay in HH:MM:SS format. This only applies if action is set to delayOpen, delayClose, or openClose. The minimum value is 00:00:01. |
sourceDevices | Body | String[] | Sometimes | The IDs of the source devices associated with an anti-passback or event rule. This is required if type is set to antiPassback or event. For anti-passback rules, these represent the entry devices. |
exitDevices | Body | String[] | Sometimes | The IDs of the exit devices associated with an anti-passback rule. This is required if type is set to antiPassback. |
expiration | Body | Integer or Null | Sometimes | The duration (in seconds) of an anti-passback rule. This is required if type is set to antiPassback. The maximum value is 31536000 (1 year) or null (no expiration). |
target | Body | String | Sometimes | Whether the target devices of an event rule should be the same as the source devices or individually selected. This is required if type is set to event. Possible values include source and selected. |
targetDevices | Body | String[] | Sometimes | The IDs of the target devices associated with an event rule. This is required if target is set to selected. |
Response
HTTP/1.1 204 No Content
Delete a group rule
Request
DELETE https://systems.pdk.io/{{system_id}}/groups/{{group_id}}/rules/{{rule_id}} HTTP/1.1
Authorization: Bearer {{system_token}}
| Parameter | Location | Type | Required | Description |
|---|---|---|---|---|
system_id | Path | String | Yes | The system ID. |
group_id | Path | String | Yes | The group ID. |
rule_id | Path | String | Yes | The rule ID. |
system_token | Header | String | Yes | A valid system token. |
Response
HTTP/1.1 204 No Content
List all group rules
Request
GET https://systems.pdk.io/{{system_id}}/groups/{{group_id}}/rules HTTP/1.1
Authorization: Bearer {{system_token}}
| Parameter | Location | Type | Required | Description |
|---|---|---|---|---|
system_id | Path | String | Yes | The system ID. |
group_id | Path | String | Yes | The group ID. |
sort | Query | String | No | The sort order for results. Possible values include asc and desc. The default value is asc. |
page | Query | Integer | No | The zero-based page number used for pagination. The default value is 0. |
per_page | Query | Integer | No | The number of items per page used for pagination. The default value is 10 and the maximum value is 1000. |
system_token | Header | String | Yes | A valid system token. |
Response
The response contains an array of rule objects.
HTTP/1.1 200 OK
Content-Type: application/json
[
{
"id": "584e6c47-a7cd-44f1-aba0-0453858dfd41",
"type": "access",
"allow": true,
"authenticationPolicy": "cardOrPin",
"devices": [
{
"id": "35347d04-a99c-4a58-ab32-1317b832507a",
"name": "Test Device",
"cloudNode": {
"id": "7d829ff4-53e8-4d76-8762-1022ccdeae39",
"name": "Test Cloud Node",
"serialNumber": "1234ABC"
}
}
],
"startTime": "09:00",
"stopTime": "17:00",
"recurring": [
"Mon",
"Tue",
"Wed",
"Thu",
"Fri"
]
}
]
Auto Open Rules
Create an auto open rule
Request
POST https://systems.pdk.io/{{system_id}}/auto-open HTTP/1.1
Authorization: Bearer {{system_token}}
Content-Type: application/json
{
"allow": true,
"devices": [
"35347d04-a99c-4a58-ab32-1317b832507a"
],
"startTime": "09:00",
"stopTime": "17:00",
"recurring": [
"Mon",
"Tue",
"Wed",
"Thu",
"Fri"
]
}
| Parameter | Location | Type | Required | Description |
|---|---|---|---|---|
system_id | Path | String | Yes | The system ID. |
system_token | Header | String | Yes | A valid system token. |
allow | Body | Boolean | Yes | Whether access should be granted or denied. |
devices | Body | String[] | Yes | The IDs of the devices associated with this rule. |
startTime | Body | String | Yes | The rule start time using 24-hour HH:MM format. |
stopTime | Body | String | Yes | The rule stop time using 24-hour HH:MM format. This must be greater than startTime. |
recurring | Body | String[] | Sometimes | The days of the week this rule should be active. Possible values include Mon, Tue, Wed, Thu, Fri, Sat, and Sun. This is required if singleDate is omitted. |
singleDate | Body | String | Sometimes | The specific date this rule should be active. This should be formatted as YYYY-MM-DD. Dates in the past are not allowed. This is required if recurring is omitted. |
name | Body | String | No | The auto open rule name. |
partition | Body | String | No | The partition ID. |
Response
The response contains the ID of the newly created rule object.
HTTP/1.1 200 OK
Content-Type: application/json
{
"id": "79171b1f-06e2-4a96-95cf-00d266f474d2"
}
Retrieve an auto open rule
Request
GET https://systems.pdk.io/{{system_id}}/auto-open/{{rule_id}} HTTP/1.1
Authorization: Bearer {{system_token}}
| Parameter | Location | Type | Required | Description |
|---|---|---|---|---|
system_id | Path | String | Yes | The system ID. |
rule_id | Path | String | Yes | The rule ID. |
system_token | Header | String | Yes | A valid system token. |
Response
The response contains a rule object.
HTTP/1.1 200 OK
Content-Type: application/json
{
"id": "79171b1f-06e2-4a96-95cf-00d266f474d2",
"name": null,
"partition": "619cceb0-ac58-4b15-a8ec-32efcb0476ba",
"type": "autoOpen",
"allow": true,
"devices": [
{
"id": "35347d04-a99c-4a58-ab32-1317b832507a",
"name": "Test Device",
"cloudNode": {
"id": "7d829ff4-53e8-4d76-8762-1022ccdeae39",
"name": "Test Cloud Node",
"serialNumber": "1234ABC"
}
}
],
"startTime": "09:00",
"stopTime": "17:00",
"recurring": [
"Mon",
"Tue",
"Wed",
"Thu",
"Fri"
]
}
Update an auto open rule
Request
PUT https://systems.pdk.io/{{system_id}}/auto-open/{{rule_id}} HTTP/1.1
Authorization: Bearer {{system_token}}
Content-Type: application/json
{
"allow": true,
"devices": [
"35347d04-a99c-4a58-ab32-1317b832507a"
],
"startTime": "09:00",
"stopTime": "17:00",
"recurring": [
"Mon",
"Tue",
"Wed",
"Thu",
"Fri"
]
}
| Parameter | Location | Type | Required | Description |
|---|---|---|---|---|
system_id | Path | String | Yes | The system ID. |
rule_id | Path | String | Yes | The rule ID. |
system_token | Header | String | Yes | A valid system token. |
allow | Body | Boolean | Yes | Whether access should be granted or denied. |
devices | Body | String[] | Yes | The IDs of the devices associated with this rule. |
startTime | Body | String | Yes | The rule start time using 24-hour HH:MM format. |
stopTime | Body | String | Yes | The rule stop time using 24-hour HH:MM format. This must be greater than startTime. |
recurring | Body | String[] | Sometimes | The days of the week this rule should be active. Possible values include Mon, Tue, Wed, Thu, Fri, Sat, and Sun. This is required if singleDate is omitted. |
singleDate | Body | String | Sometimes | The specific date this rule should be active. This should be formatted as YYYY-MM-DD. Dates in the past are not allowed. This is required if recurring is omitted. |
name | Body | String | No | The auto open rule name. |
partition | Body | String | No | The partition ID. |
Response
HTTP/1.1 204 No Content
Delete an auto open rule
Request
DELETE https://systems.pdk.io/{{system_id}}/auto-open/{{rule_id}} HTTP/1.1
Authorization: Bearer {{system_token}}
| Parameter | Location | Type | Required | Description |
|---|---|---|---|---|
system_id | Path | String | Yes | The system ID. |
rule_id | Path | String | Yes | The rule ID. |
system_token | Header | String | Yes | A valid system token. |
Response
HTTP/1.1 204 No Content
List all auto open rules
Request
GET https://systems.pdk.io/{{system_id}}/auto-open HTTP/1.1
Authorization: Bearer {{system_token}}
| Parameter | Location | Type | Required | Description |
|---|---|---|---|---|
system_id | Path | String | Yes | The system ID. |
search | Query | String | No | A keyword used to filter the results by searching for partial matches against the name property. |
page | Query | Integer | No | The zero-based page number used for pagination. The default value is 0. |
per_page | Query | Integer | No | The number of items per page used for pagination. The default value is 10 and the maximum value is 100. |
system_token | Header | String | Yes | A valid system token. |
Response
The response contains an array of rule objects.
HTTP/1.1 200 OK
Content-Type: application/json
[
{
"id": "79171b1f-06e2-4a96-95cf-00d266f474d2",
"name": null,
"partition": "619cceb0-ac58-4b15-a8ec-32efcb0476ba",
"type": "autoOpen",
"allow": true,
"devices": [
{
"id": "35347d04-a99c-4a58-ab32-1317b832507a",
"name": "Test Device",
"cloudNode": {
"id": "7d829ff4-53e8-4d76-8762-1022ccdeae39",
"name": "Test Cloud Node",
"serialNumber": "1234ABC"
}
}
],
"startTime": "09:00",
"stopTime": "17:00",
"recurring": [
"Mon",
"Tue",
"Wed",
"Thu",
"Fri"
]
}
]
System Event Rules
Create a system event rule
Request
POST https://systems.pdk.io/{{system_id}}/system-events HTTP/1.1
Authorization: Bearer {{system_token}}
Content-Type: application/json
{
"name": "Test System Event Rule",
"triggerType": "onDoorPropped",
"sourceDevices": [
"35347d04-a99c-4a58-ab32-1317b832507a"
],
"action": "sendEmail",
"emailTemplate": {
"to": [
"john@example.com"
],
"subject": "Test Subject",
"body": "Test Body"
},
"startTime": "09:00",
"stopTime": "17:00",
"recurring": [
"Mon",
"Tue",
"Wed",
"Thu",
"Fri"
]
}
| Parameter | Location | Type | Required | Description |
|---|---|---|---|---|
system_id | Path | String | Yes | The system ID. |
system_token | Header | String | Yes | A valid system token. |
name | Body | String | Yes | The system event rule name. The maximum length is 70 characters. |
partition | Body | String | No | The partition ID. |
triggerType | Body | String | Yes | The rule trigger type. Possible values include allPropCleared, onAnyDuress, onBatteryConnect, onBatteryDisconnect, onCardNotFound, onCardSwipe, onCircuitBreakerOff, onCircuitBreakerOn, onComLoss, onComLossCleared, onDoorClose, onDoorForced, onDoorOpen, onDoorPropped, onInputPowerLoss, onInputPowerRecovery, onJammed, onJammedClear, onLowPowerModeOff, onLowPowerModeOn, onOverCurrentCleared, onOverCurrentDetected, onPartialConnectivityCleared, onPartialConnectivityDetected, onPropCleared, onRequest, onRexClose, onRexOpen, onUnderVoltageCleared, and onUnderVoltageDetected. |
sourceDevices | Body | String[] | Sometimes | The IDs of the source devices associated with this rule. This property must be omitted when triggerType is set to onRequest (since the rule is triggered by an API request in that case). Otherwise, the array must contain at least 1 unique value. |
target | Body | String | Sometimes | Whether the target devices of this rule should be the same as the source devices or individually selected. Possible values include source and selected. |
targetDevices | Body | String[] | Sometimes | The IDs of the target devices associated with this rule. This is required if target is set to selected, in which case the array must contain at least 1 unique value. |
action | Body | String | Yes | The system event rule action. Possible values include close, delayClose, delayOpen, doNotDisturb, forceClose, forceOpen, forceToggle, lockdownOff, lockdownOn, open, openClose, piezoOff, piezoOn, pushNotification, and sendEmail. Values of sendEmail and pushNotification are not permitted when triggerType is set to onRequest. |
emailTemplate | Body | Object | Sometimes | The email template. This is required if action is set to sendEmail. |
emailTemplate.to | Body | String[] | Yes | An array of 1–30 unique recipient email addresses. Example: ["john@example.com"] |
emailTemplate.subject | Body | String | Yes | The email template subject. The maximum length is 255 characters. |
emailTemplate.body | Body | String | Yes | The email template body. The maximum length is 2048 characters. Email template variables may be used for customization. |
recipients | Body | String[] | Sometimes | An array of 1–30 user IDs. These users will receive push notifications when the rule is triggered. This is required if action is set to pushNotification. |
onTime | Body | Integer | No | The duration (in tenths of a second) of each tone in the piezo tone sequence. This only applies if action is set to piezoOn. The minimum value is 1 and the maximum value is 255. |
offTime | Body | Integer | No | The duration (in tenths of a second) of silence between each tone in the piezo tone sequence. This only applies if action is set to piezoOn. The minimum value is 0 and the maximum value is 255. |
count | Body | Integer | No | The number of times the piezo tone sequence is repeated. This only applies if action is set to piezoOn. The minimum value is 0 and the maximum value is 255. |
dwell | Body | String | No | The dwell time in HH:MM:SS format. This only applies if action is set to openClose. The minimum value is 00:00:01. |
delay | Body | String | No | The action delay in HH:MM:SS format. This only applies if action is set to delayOpen, delayClose, or openClose. The minimum value is 00:00:01. |
startTime | Body | String | Yes | The rule start time using 24-hour HH:MM format. |
stopTime | Body | String | Yes | The rule stop time using 24-hour HH:MM format. This must be greater than startTime. |
recurring | Body | String[] | Sometimes | The days of the week this rule should be active. Possible values include Mon, Tue, Wed, Thu, Fri, Sat, and Sun. This is required if singleDate is omitted. |
singleDate | Body | String | Sometimes | The specific date this rule should be active. This should be formatted as YYYY-MM-DD. Dates in the past are not allowed. This is required if recurring is omitted. |
Response
The response contains the ID of the newly created rule object.
HTTP/1.1 201 Created
Content-Type: application/json
{
"id": "8d46ccc0-8e08-465f-aebd-33eb4e03a821"
}
Retrieve a system event rule
Request
GET https://systems.pdk.io/{{system_id}}/system-events/{{rule_id}} HTTP/1.1
Authorization: Bearer {{system_token}}
| Parameter | Location | Type | Required | Description |
|---|---|---|---|---|
system_id | Path | String | Yes | The system ID. |
rule_id | Path | String | Yes | The rule ID. |
system_token | Header | String | Yes | A valid system token. |
Response
The response contains a rule object.
HTTP/1.1 200 OK
Content-Type: application/json
{
"id": "8d46ccc0-8e08-465f-aebd-33eb4e03a821",
"name": "Test System Event Rule",
"partition": "619cceb0-ac58-4b15-a8ec-32efcb0476ba",
"type": "systemEvent",
"startTime": "09:00",
"stopTime": "17:00",
"recurring": [
"Mon",
"Tue",
"Wed",
"Thu",
"Fri"
],
"triggerType": "onDoorPropped",
"action": "sendEmail",
"emailTemplate": {
"to": [
"john@example.com"
],
"subject": "Test Subject",
"body": "Test Body"
},
"sourceDevices": [
{
"id": "86d8771e-507c-426d-9076-737cf0c3fb0c",
"name": "Test Device",
"firmwareVersion": "2.0.4",
"hardwareVersion": "red1cn.d",
"cloudNode": {
"id": "7d829ff4-53e8-4d76-8762-1022ccdeae39",
"serialNumber": "1234ABC",
"name": "Test Cloud Node"
}
}
]
}
Update a system event rule
Request
PUT https://systems.pdk.io/{{system_id}}/system-events/{{rule_id}} HTTP/1.1
Authorization: Bearer {{system_token}}
Content-Type: application/json
{
"name": "Test System Event Rule",
"triggerType": "onDoorPropped",
"sourceDevices": [
"35347d04-a99c-4a58-ab32-1317b832507a"
],
"action": "sendEmail",
"emailTemplate": {
"to": [
"john@example.com"
],
"subject": "Test Subject",
"body": "Test Body"
},
"startTime": "09:00",
"stopTime": "17:00",
"recurring": [
"Mon",
"Tue",
"Wed",
"Thu",
"Fri"
]
}
| Parameter | Location | Type | Required | Description |
|---|---|---|---|---|
system_id | Path | String | Yes | The system ID. |
rule_id | Path | String | Yes | The rule ID. |
system_token | Header | String | Yes | A valid system token. |
name | Body | String | Yes | The system event rule name. The maximum length is 70 characters. |
partition | Body | String | No | The partition ID. |
triggerType | Body | String | Yes | The rule trigger type. Possible values include allPropCleared, onAnyDuress, onBatteryConnect, onBatteryDisconnect, onCardNotFound, onCardSwipe, onCircuitBreakerOff, onCircuitBreakerOn, onComLoss, onComLossCleared, onDoorClose, onDoorForced, onDoorOpen, onDoorPropped, onInputPowerLoss, onInputPowerRecovery, onJammed, onJammedClear, onLowPowerModeOff, onLowPowerModeOn, onOverCurrentCleared, onOverCurrentDetected, onPartialConnectivityCleared, onPartialConnectivityDetected, onPropCleared, onRequest, onRexClose, onRexOpen, onUnderVoltageCleared, and onUnderVoltageDetected. |
sourceDevices | Body | String[] | Sometimes | The IDs of the source devices associated with this rule. This property must be omitted when triggerType is set to onRequest (since the rule is triggered by an API request in that case). Otherwise, the array must contain at least 1 unique value. |
target | Body | String | Sometimes | Whether the target devices of this rule should be the same as the source devices or individually selected. Possible values include source and selected. |
targetDevices | Body | String[] | Sometimes | The IDs of the target devices associated with this rule. This is required if target is set to selected, in which case the array must contain at least 1 unique value. |
action | Body | String | Yes | The system event rule action. Possible values include close, delayClose, delayOpen, doNotDisturb, forceClose, forceOpen, forceToggle, lockdownOff, lockdownOn, open, openClose, piezoOff, piezoOn, pushNotification, and sendEmail. Values of sendEmail and pushNotification are not permitted when triggerType is set to onRequest. |
emailTemplate | Body | Object | Sometimes | The email template. This is required if action is set to sendEmail. |
emailTemplate.to | Body | String[] | Yes | An array of 1–30 unique recipient email addresses. Example: ["john@example.com"] |
emailTemplate.subject | Body | String | Yes | The email template subject. The maximum length is 255 characters. |
emailTemplate.body | Body | String | Yes | The email template body. The maximum length is 2048 characters. Email template variables may be used for customization. |
recipients | Body | String[] | Sometimes | An array of 1–30 user IDs. These users will receive push notifications when the rule is triggered. This is required if action is set to pushNotification. |
onTime | Body | Integer | No | The duration (in tenths of a second) of each tone in the piezo tone sequence. This only applies if action is set to piezoOn. The minimum value is 1 and the maximum value is 255. |
offTime | Body | Integer | No | The duration (in tenths of a second) of silence between each tone in the piezo tone sequence. This only applies if action is set to piezoOn. The minimum value is 0 and the maximum value is 255. |
count | Body | Integer | No | The number of times the piezo tone sequence is repeated. This only applies if action is set to piezoOn. The minimum value is 0 and the maximum value is 255. |
dwell | Body | String | No | The dwell time in HH:MM:SS format. This only applies if action is set to openClose. The minimum value is 00:00:01. |
delay | Body | String | No | The action delay in HH:MM:SS format. This only applies if action is set to delayOpen, delayClose, or openClose. The minimum value is 00:00:01. |
startTime | Body | String | Yes | The rule start time using 24-hour HH:MM format. |
stopTime | Body | String | Yes | The rule stop time using 24-hour HH:MM format. This must be greater than startTime. |
recurring | Body | String[] | Sometimes | The days of the week this rule should be active. Possible values include Mon, Tue, Wed, Thu, Fri, Sat, and Sun. This is required if singleDate is omitted. |
singleDate | Body | String | Sometimes | The specific date this rule should be active. This should be formatted as YYYY-MM-DD. Dates in the past are not allowed. This is required if recurring is omitted. |
Response
HTTP/1.1 204 No Content
Delete a system event rule
Request
DELETE https://systems.pdk.io/{{system_id}}/system-events/{{rule_id}} HTTP/1.1
Authorization: Bearer {{system_token}}
| Parameter | Location | Type | Required | Description |
|---|---|---|---|---|
system_id | Path | String | Yes | The system ID. |
rule_id | Path | String | Yes | The rule ID. |
system_token | Header | String | Yes | A valid system token. |
Response
HTTP/1.1 204 No Content
List all system event rules
Request
GET https://systems.pdk.io/{{system_id}}/system-events HTTP/1.1
Authorization: Bearer {{system_token}}
| Parameter | Location | Type | Required | Description |
|---|---|---|---|---|
system_id | Path | String | Yes | The system ID. |
search | Query | String | No | A keyword used to filter the results by searching for partial matches against the name property. The maximum length is 255 characters. |
sort | Query | String | No | The sort order for results. Possible values include asc and desc. The default value is asc. |
includeOnRequestRules | Query | Boolean | No | Whether to include system event rules with a triggerType of onRequest in the results. Possible values include true and false. The default value is false. |
page | Query | Integer | No | The zero-based page number used for pagination. The default value is 0. |
per_page | Query | Integer | No | The number of items per page used for pagination. The default value is 10 and the maximum value is 100. |
system_token | Header | String | Yes | A valid system token. |
Response
The response contains an array of rule objects.
HTTP/1.1 200 OK
Content-Type: application/json
[
{
"id": "8d46ccc0-8e08-465f-aebd-33eb4e03a821",
"name": "Test System Event Rule",
"partition": "619cceb0-ac58-4b15-a8ec-32efcb0476ba",
"type": "systemEvent",
"startTime": "09:00",
"stopTime": "17:00",
"recurring": [
"Mon",
"Tue",
"Wed",
"Thu",
"Fri"
],
"triggerType": "onDoorPropped",
"action": "sendEmail",
"emailTemplate": {
"to": [
"john@example.com"
],
"subject": "Test Subject",
"body": "Test Body"
},
"sourceDevices": [
{
"id": "86d8771e-507c-426d-9076-737cf0c3fb0c",
"name": "Test Device",
"firmwareVersion": "2.0.4",
"hardwareVersion": "red1cn.d",
"cloudNode": {
"id": "7d829ff4-53e8-4d76-8762-1022ccdeae39",
"serialNumber": "1234ABC",
"name": "Test Cloud Node"
}
}
]
}
]
Trigger a system event rule
System event rules with a triggerType of onRequest are not displayed in the user interface and can only be triggered by the following endpoint.
Request
POST https://systems.pdk.io/{{system_id}}/system-events/{{rule_id}}/trigger HTTP/1.1
Authorization: Bearer {{system_token}}
| Parameter | Location | Type | Required | Description |
|---|---|---|---|---|
system_id | Path | String | Yes | The system ID. |
rule_id | Path | String | Yes | The system event rule ID. The rule must have triggerType of onRequest. |
system_token | Header | String | Yes | A valid system token. |
Response
HTTP/1.1 204 No Content