Skip to main content
Version: 1.0

Maps

Introduction

Maps allow users to visualize their access control system by assigning coordinates to devices. There are two types of maps:

  • Local maps are based on user-provided images, with coordinates provided as pixel values relative to the top left corner of each image. A cloud node may contain multiple local maps.
  • Global maps are based on third-party mapping services (like Google Maps), with coordinates provided as geographical latitude and longitude values. A cloud node may only contain one global map.

Note that pdk.io currently only supports local maps, but global maps may be implemented by third-party applications.

The map object

{
"id": 1,
"name": "Test Map 1",
"description": "Test Map 1",
"partitions": [0],
"type": "local",
"imageUrl": "https://panel-1234ABC.pdk.io:443/images/40968370-e835-11ed-adcb-8d19f7185405",
"opacity": 100,
"iconSize": "M",
"doors": [
{
"id": 1,
"displayName": true,
"x": 100,
"y": 100
}
],
"links": [
{
"id": 2,
"name": "Test Map 2",
"x": 200,
"y": 200
}
]
}
PropertyTypeDescription
idIntegerThe map ID.
nameStringThe map name.
descriptionStringThe map description.
partitionsInteger[]The partition IDs associated with this map.
typeStringThe map type. Possible values include local and global.
imageUrlStringThe URL of the user-provided map image.
opacityIntegerThe image opacity.
iconSizeStringThe icon size. Possible values include S, M, and L.
doorsObject[]An array of devices and their accompanying coordinates.
doors.idIntegerThe device ID.
doors.displayNameBooleanWhether the device name is displayed alongside the icon.
doors.xIntegerThe horizontal pixel coordinate of the device relative to the top left of the image.
doors.yIntegerThe vertical pixel coordinate of the device relative to the top left of the image.
linksObject[]An array of linked maps and their accompanying coordinates.
links.idIntegerThe linked map ID.
links.xIntegerThe horizontal pixel coordinate of the linked map relative to the top left of the image.
links.yIntegerThe vertical pixel coordinate of the linked map relative to the top left of the image.

Basic Endpoints

Create a map

Request

POST https://panel-{{panel_id}}.pdk.io/api/maps HTTP/1.1
Authorization: Bearer {{panel_token}}
Content-Type: application/json

{
"name": "Test Map 1",
"description": "Test Map 1",
"partitions": [0],
"type": "local",
"image": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAHgAAAB4CAAAAAAcD2kOAAABZklEQVR4Ae3XAYnDMBTG8RqogBqIgRqogBiYgRiogBqYgRiIgBh4Bj5Rd13yIAs5uHHrGwffH2DNI+MH3cLWCR+KMGHChAkTJkz4tQgTJkyYMGHChAkTJkyYcIqDZDAXlOQevqtLiYPSr+B1GhQH84iztOnaHQDiNGi9AA7txCUrWF1tsYJ7JvwFvq2PlvqeUlJ4qYMyq5/vFoI7X2dBWktTu/v2wnHSm9jfiYAmKXvu53X29aI0dbvfC8enG5kTbGEHzRiednNY9BQd+XJ4DaUDZ27S3C5Xwv3RvLcjL3YwfDubkx2M0MtWMHJYmul1sB/8xKbgVM4mx6m1Kx2tYcjyIRjeFJZtU8qZwar5fF4d5TzhGrj/I7DXQxT0a+0vg9tinrvJnG1g6UcHbGBgn5v1fMAMhuxOlz7jLXCOj6D9+AiTyxMMnitbMp8WCRMmTJgwYcKECRMmTJgwYcKECRMmTPhfwV9kH2srWmFAYQAAAABJRU5ErkJggg==",
"opacity": 100,
"doors": [
{
"id": 1,
"displayName": true,
"x": 100,
"y": 100
}
],
"links": [
{
"id": 2,
"name": "Test Map 2",
"x": 200,
"y": 200
}
]
}
ParameterLocationTypeRequiredDescription
panel_idPathStringYesThe cloud node serial number.
panel_tokenHeaderStringYesA valid panel token.
nameBodyStringYesThe map name. This must be unique within a cloud node.
descriptionBodyStringYesThe map description. This must be unique within a cloud node.
partitionsBodyInteger[]YesThe partition IDs associated with this map.
typeBodyStringYesThe map type. Possible values include local and global.
imageBodyStringYesThe map image encoded as a data URL.
opacityBodyIntegerNoThe image opacity. Adjusting the opacity may help improve the readability of overlaid text. The minimum value is 0 (default) and the maximum value is 100. While not strictly required, this value should always be specified since the image will otherwise be invisible by default.
iconSizeBodyStringNoThe icon size. Possible values include S, M, and L.
doorsBodyObject[]YesAn array of devices and their accompanying coordinates.
doors.idBodyIntegerYesThe device ID.
doors.displayNameBodyBooleanYesWhether the device name should be displayed alongside the icon.
doors.xBodyIntegerYesThe horizontal pixel coordinate of the device relative to the top left of the image.
doors.yBodyIntegerYesThe vertical pixel coordinate of the device relative to the top left of the image.
linksBodyObject[]YesAn array of linked maps and their accompanying coordinates.
links.idBodyIntegerYesThe linked map ID.
links.xBodyIntegerYesThe horizontal pixel coordinate of the linked map relative to the top left of the image.
links.yBodyIntegerYesThe vertical pixel coordinate of the linked map relative to the top left of the image.

Response

The response contains the ID of the newly created map object.

HTTP/1.1 200 OK
Content-Type: application/json

{
"id": 1
}

Retrieve a map

Request

GET https://panel-{{panel_id}}.pdk.io/api/maps/{{map_id}} HTTP/1.1
Authorization: Bearer {{panel_token}}
ParameterLocationTypeRequiredDescription
panel_idPathStringYesThe cloud node serial number.
map_idPathIntegerYesThe map ID.
panel_tokenHeaderStringYesA valid panel token.

Response

The response contains a map object.

HTTP/1.1 200 OK
Content-Type: application/json

{
"id": 1,
"name": "Test Map 1",
"description": "Test Map 1",
"partitions": [0],
"type": "local",
"imageUrl": "https://panel-1234ABC.pdk.io:443/images/40968370-e835-11ed-adcb-8d19f7185405",
"opacity": 100,
"iconSize": "M",
"doors": [
{
"id": 1,
"displayName": true,
"x": 100,
"y": 100
}
],
"links": [
{
"id": 2,
"name": "Test Map 2",
"x": 200,
"y": 200
}
]
}

Update a map

Request

PUT https://panel-{{panel_id}}.pdk.io/api/maps/{{map_id}} HTTP/1.1
Authorization: Bearer {{panel_token}}
Content-Type: application/json

{
"name": "Test Map 1",
"description": "Test Map 1",
"partitions": [0],
"type": "local",
"image": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAHgAAAB4CAAAAAAcD2kOAAABZklEQVR4Ae3XAYnDMBTG8RqogBqIgRqogBiYgRiogBqYgRiIgBh4Bj5Rd13yIAs5uHHrGwffH2DNI+MH3cLWCR+KMGHChAkTJkz4tQgTJkyYMGHChAkTJkyYcIqDZDAXlOQevqtLiYPSr+B1GhQH84iztOnaHQDiNGi9AA7txCUrWF1tsYJ7JvwFvq2PlvqeUlJ4qYMyq5/vFoI7X2dBWktTu/v2wnHSm9jfiYAmKXvu53X29aI0dbvfC8enG5kTbGEHzRiednNY9BQd+XJ4DaUDZ27S3C5Xwv3RvLcjL3YwfDubkx2M0MtWMHJYmul1sB/8xKbgVM4mx6m1Kx2tYcjyIRjeFJZtU8qZwar5fF4d5TzhGrj/I7DXQxT0a+0vg9tinrvJnG1g6UcHbGBgn5v1fMAMhuxOlz7jLXCOj6D9+AiTyxMMnitbMp8WCRMmTJgwYcKECRMmTJgwYcKECRMmTPhfwV9kH2srWmFAYQAAAABJRU5ErkJggg==",
"opacity": 100,
"doors": [
{
"id": 1,
"displayName": true,
"x": 100,
"y": 100
}
],
"links": [
{
"id": 2,
"name": "Test Map 2",
"x": 200,
"y": 200
}
]
}
ParameterLocationTypeRequiredDescription
panel_idPathStringYesThe cloud node serial number.
map_idPathIntegerYesThe map ID.
panel_tokenHeaderStringYesA valid panel token.
nameBodyStringYesThe map name. This must be unique within a cloud node.
descriptionBodyStringYesThe map description. This must be unique within a cloud node.
partitionsBodyInteger[]YesThe partition IDs associated with this map.
typeBodyStringYesThe map type. Possible values include local and global.
imageBodyStringYesThe map image encoded as a data URL.
opacityBodyIntegerNoThe image opacity. Adjusting the opacity may help improve the readability of overlaid text. The minimum value is 0 (default) and the maximum value is 100. While not strictly required, this value should always be specified since the image will otherwise be invisible by default.
iconSizeBodyStringNoThe icon size. Possible values include S, M, and L.
doorsBodyObject[]YesAn array of devices and their accompanying coordinates.
doors.idBodyIntegerYesThe device ID.
doors.displayNameBodyBooleanYesWhether the device name should be displayed alongside the icon.
doors.xBodyIntegerYesThe horizontal pixel coordinate of the device relative to the top left of the image.
doors.yBodyIntegerYesThe vertical pixel coordinate of the device relative to the top left of the image.
linksBodyObject[]YesAn array of linked maps and their accompanying coordinates.
links.idBodyIntegerYesThe linked map ID.
links.xBodyIntegerYesThe horizontal pixel coordinate of the linked map relative to the top left of the image.
links.yBodyIntegerYesThe vertical pixel coordinate of the linked map relative to the top left of the image.

Response

HTTP/1.1 204 No Content

Delete a map

Request

DELETE https://panel-{{panel_id}}.pdk.io/api/maps/{{map_id}} HTTP/1.1
Authorization: Bearer {{panel_token}}
ParameterLocationTypeRequiredDescription
panel_idPathStringYesThe cloud node serial number.
map_idPathIntegerYesThe map ID.
panel_tokenHeaderStringYesA valid panel token.

Response

HTTP/1.1 204 No Content

List all maps

Request

GET https://panel-{{panel_id}}.pdk.io/api/maps HTTP/1.1
Authorization: Bearer {{panel_token}}
ParameterLocationTypeRequiredDescription
panel_idPathStringYesThe cloud node serial number.
panel_tokenHeaderStringYesA valid panel token.

Response

The response contains an array of map objects.

HTTP/1.1 200 OK
Content-Type: application/json

[
{
"id": 1,
"name": "Test Map 1",
"description": "Test Map 1",
"partitions": [0],
"type": "local",
"imageUrl": "https://panel-1234ABC.pdk.io:443/images/40968370-e835-11ed-adcb-8d19f7185405",
"opacity": 100,
"iconSize": "M",
"doors": [
{
"id": 1,
"displayName": true,
"x": 100,
"y": 100
}
],
"links": [
{
"id": 3,
"name": "Test Map 3",
"x": 200,
"y": 200
}
]
},
{
"id": 2,
"name": "Test Map 2",
"description": "Test Map 2",
"type": "global",
"latitude": 40.5052747,
"longitude": -111.8931252,
"zoom": 17,
"iconSize": "M",
"doors": [
{
"id": 2,
"displayName": true,
"latitude": 40.5052747,
"longitude": -111.8931252
}
],
"links": [
{
"id": 4,
"name": "Test Map 4",
"latitude": 40.7765786,
"longitude": -112.0028844
}
]
}
]