Skip to content

Interacting Access Control devices

Access control devices represent devices which control access to a restricted area. This can be a boom gate, a door or any other access control. Access at the device can be granted based on access codes. Examples for access codes are a car’s license plate at a boom gate or a PIN code entered at a digital door lock. A “code type” is provided that can be used to identify the type of code used.

When access is requested at the device, the device will have a pending access request with the code that was provided.

Querying Access Control devices

Use the accessControlDevices connection to get all access control devices:

query accessControlDevices {
accessControlDevices {
edges {
node {
id label externalId
currentRequest {
code codeType id status
}
directions
status {
status message statusCode
}
}
}
}
}

A typical response would look like this:

{
"data": {
"accessControlDevices": {
"edges": [
{
"node": {
"id": "QWNjZXNzQ29udHJvbERldmljZTo3NGI0YmExZi0xNTU2LTRhNmYtOGRiMC0wZTExNTllOTk2OTE=",
"externalId": "dcbb35b8-2d17-4df2-9cf3-9649d07a4539",
"label": "Access Device 1",
"currentRequest": {
"code": "3655964208",
"codeType": "PIN_CODE",
"id": "QWNjZXNzQ29udHJvbFJlcXVlc3Q6OWFlODk4N2ItYWYyZS00NzA3LTg2MDUtMzkyZmJkYTFhZWI1",
"status": "PENDING"
},
"directions": [
"EXIT"
],
"status": {
"status": "AVAILABLE",
"message": "Ready.",
"statusCode": ""
}
}
}
]
}
}
}

You can provide the filters parameter to filter the devices by campsite or request a specific device using the external ID.

The currentRequest property provides any current pending access request on the device. You can use Webhooks or GraphQL Subscriptions to get notified about when this changes.

Responding to access requests

Use the accessControlDeviceRespondRequest mutation to either grant or deny the currently pending request:

Grant access example:

mutation grantAccess($requestId: GlobalID!, $message: String) {
accessControlDeviceRespondRequest(requestId: $requestId, message: $message) {
...on AccessControlDeviceCommand {
id
executionState
}
...on OperationInfo {
messages {
kind message code field
}
}
}
}

Example data:

{
"requestId": "QWNjZXNzQ29udHJvbFJlcXVlc3Q6ZTUyYmFiOWYtMjIyYS00ODQ0LThmNjctNTY0NjU4MGRmNzMy",
"denialReason": "BLOCKED",
"message": "Welcome",
}

The “message” field is purely informational. It may be used to specify why a request was denied, or it could be used to provide greeting message when access is granted. Depending on the type of access device, the message may be ignored.

Deny access example:

mutation denyAccess($requestId: GlobalID!, $reason: AccessControlDeviceDenialReason!, $message: String) {
accessControlDeviceRespondRequest(requestId: $requestId, denialReason: $reason, message: $message) {
...on AccessControlDeviceCommand {
id
executionState
}
...on OperationInfo {
messages {
kind message code field
}
}
}
}

After sending the command, you will receive either the created command or an error message. You can use the created command’s ID to either poll the state of the command via the node query or use Webhooks or GraphQL subscriptions to get notified when the command is completed.

Immediate open

An access control device can be instructed to open without an immediately pending request. This can be used to e.g. open a boom gate manually.

Use the accessControlDeviceOpen mutation to achieve this. It functions similarly to the command mutations described above:

mutation denyAccess($deviceId: GlobalID!) {
accessControlDeviceOpen(deviceId: $deviceId) {
...on AccessControlDeviceCommand {
id
executionState
}
...on OperationInfo {
messages {
kind message code field
}
}
}
}