Skip to main content
Version: 1.0

Organizations

Introduction

Organizations are hierarchical groups of cloud nodes and permissions. Parent organizations represent registered PDK dealers and child organizations represent their customers. Note that the API sometimes refers to organizations as OUs (organizational units).

The organization object

{
"id": "64398c446e22d40001eeaf34",
"name": "Test Dealer",
"useBluetoothCredentials": true,
"useTouchMobileApp": true,
"allowCredentialResets": true,
"ancestors": ["544557759a01deb9874c02ef"],
"parent": "544557759a01deb9874c02ef",
"children": [
{
"id": "643f0e8f6e22d40001eeb5e6",
"name": "Test Customer",
"useBluetoothCredentials": true,
"useTouchMobileApp": true,
"allowCredentialResets": true
}
],
"panels": [
{
"id": "1234ABC",
"name": "Test Panel",
"online": true,
"allowCredentialResets": true,
"credentialResetsPerMonth": 1,
"reportBillingPolicy": "basic",
"uri": "https://panel-1234ABC.pdk.io/",
"registeredDate": "2023-05-01T14:42:36.220Z"
}
],
"readers": [
{
"_id": "032500000001773C",
"deviceId": 1,
"type": "red",
"panelId": "1234ABC"
}
],
"userPermissionLevel": "admin",
"parentPermissionLevel": "guest",
"permissions": [
{
"userId": "644a19ba6e22d40001eec732",
"_id": "644a19ba6e22d40001eec733",
"email": "john@example.com",
"name": "John Wiegand",
"role": "admin"
}
]
}
PropertyTypeDescription
idStringThe organization ID.
nameStringThe organization name.
useBluetoothCredentialsBooleanWhether Bluetooth credentials are enabled for the organization.
useTouchMobileAppBooleanWhether mobile credentials are enabled for the organization.
allowCredentialResetsBooleanWhether credential self-help is enabled for the organization.
ancestorsString[]A list of parent organization IDs.
parentStringThe parent organization ID.
childrenObject[]A list of child organization objects. Note that not all available properties are included in each object.
panelsObject[]A list of panel objects representing the cloud nodes associated with the organization.
readersObject[]A list of readers associated with the organization.
readers._idStringThe reader serial number.
readers.deviceIdIntegerThe ID of the device associated with the reader.
readers.typeStringThe reader type.
readers.panelIdStringThe serial number of the cloud node associated with the reader.
userPermissionLevelStringThe authenticated user's permission level for the organization.
parentPermissionLevelStringThe authenticated user's permission level for the organization's parent.
permissionsObject[]A list of permission objects associated with the organization.

Basic Endpoints

Retrieve an organization

Request

GET https://accounts.pdk.io/api/ous/{{organization_id}} HTTP/1.1
Authorization: Bearer {{id_token}}
ParameterLocationTypeRequiredDescription
organization_idPathStringYesThe organization ID.
id_tokenHeaderStringYesA valid ID token.

Response

The response contains an organization object.

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

{
"id": "64398c446e22d40001eeaf34",
"name": "Test Dealer",
"useBluetoothCredentials": true,
"useTouchMobileApp": true,
"allowCredentialResets": true,
"ancestors": ["544557759a01deb9874c02ef"],
"parent": "544557759a01deb9874c02ef",
"children": [
{
"id": "643f0e8f6e22d40001eeb5e6",
"name": "Test Customer",
"useBluetoothCredentials": true,
"useTouchMobileApp": true,
"allowCredentialResets": true
}
],
"panels": [
{
"id": "1234ABC",
"name": "Test Panel",
"online": true,
"allowCredentialResets": true,
"credentialResetsPerMonth": 1,
"reportBillingPolicy": "basic",
"uri": "https://panel-1234ABC.pdk.io/",
"registeredDate": "2023-05-01T14:42:36.220Z"
}
],
"readers": [
{
"_id": "032500000001773C",
"deviceId": 1,
"type": "red",
"panelId": "1234ABC"
}
],
"userPermissionLevel": "admin",
"parentPermissionLevel": "guest",
"permissions": [
{
"userId": "644a19ba6e22d40001eec732",
"_id": "644a19ba6e22d40001eec733",
"email": "john@example.com",
"name": "John Wiegand",
"role": "admin"
}
]
}

Search within an organization

This endpoint allows you to search for customers and cloud nodes within a specific organization. Searchable fields include organization names, cloud node names, and cloud node serial numbers.

Request

GET https://accounts.pdk.io/api/ous/{{organization_id}}/search?q=test HTTP/1.1
Authorization: Bearer {{id_token}}
ParameterLocationTypeRequiredDescription
organization_idPathStringYesThe organization ID.
qQueryStringNoThe search query.
id_tokenHeaderStringYesA valid ID token.

Response

The response contains an array of entities matching the search query.

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

[
{
"_id": "649d9ca6e5adcb0001f2678f",
"type": "ou",
"name": "Test Customer"
},
{
"_id": "1234ABC",
"type": "panel",
"name": "Test Panel"
}
]
PropertyTypeDescription
_idStringThe ID of the customer or cloud node.
typeStringThe entity type. Possible values include ou for customers and panel for cloud nodes.
nameStringThe name of the customer or cloud node.

List all my organizations

Request

GET https://accounts.pdk.io/api/ous/mine HTTP/1.1
Authorization: Bearer {{id_token}}
Accept: application/vnd.pdk.v2+json
ParameterLocationTypeRequiredDescription
id_tokenHeaderStringYesA valid ID token.
info

This endpoint is versioned and requires the Accept header to work properly.

Response

The response contains an array of organization objects.

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

[
{
"id": "64398c446e22d40001eeaf34",
"name": "Test Dealer",
"useBluetoothCredentials": true,
"useTouchMobileApp": true,
"allowCredentialResets": true,
"ancestors": ["544557759a01deb9874c02ef"],
"parent": "544557759a01deb9874c02ef",
"children": [
{
"id": "643f0e8f6e22d40001eeb5e6",
"name": "Test Customer",
"useBluetoothCredentials": true,
"useTouchMobileApp": true,
"allowCredentialResets": true
}
],
"panels": [
{
"id": "1234ABC",
"name": "Test Panel",
"online": true,
"allowCredentialResets": true,
"credentialResetsPerMonth": 1,
"reportBillingPolicy": "basic",
"uri": "https://panel-1234ABC.pdk.io/",
"registeredDate": "2023-05-01T14:42:36.220Z"
}
],
"readers": [
{
"_id": "032500000001773C",
"deviceId": 1,
"type": "red",
"panelId": "1234ABC"
}
],
"userPermissionLevel": "admin",
"parentPermissionLevel": "guest",
"permissions": [
{
"userId": "644a19ba6e22d40001eec732",
"_id": "644a19ba6e22d40001eec733",
"email": "john@example.com",
"name": "John Wiegand",
"role": "admin"
}
]
},
{
"id": "64398c446e22d40001eeaf34",
"name": "Test Customer",
"useBluetoothCredentials": true,
"useTouchMobileApp": true,
"allowCredentialResets": true,
"ancestors": ["544557759a01deb9874c02ef", "55ca2050bbed06f4348b26e8"],
"parent": "55ca2050bbed06f4348b26e8",
"children": [],
"panels": [
{
"id": "1234DEF",
"name": "Test Panel",
"online": true,
"allowCredentialResets": true,
"credentialResetsPerMonth": 1,
"reportBillingPolicy": "basic",
"uri": "https://panel-1234DEF.pdk.io/",
"registeredDate": "2023-05-01T14:42:36.220Z"
}
],
"readers": [
{
"_id": "032500000001773C",
"deviceId": 1,
"type": "red",
"panelId": "1234DEF"
}
],
"userPermissionLevel": "admin",
"parentPermissionLevel": "guest",
"permissions": [
{
"userId": "644a19ba6e22d40001eec732",
"_id": "644a19ba6e22d40001eec733",
"email": "john@example.com",
"name": "John Wiegand",
"role": "admin"
}
]
}
]

Search within all my organizations

This endpoint allows you to search for customers and cloud nodes within all your organizations. Searchable fields include organization names, cloud node names, and cloud node serial numbers.

Request

GET https://accounts.pdk.io/api/ous/mine/search?q=test HTTP/1.1
Authorization: Bearer {{id_token}}
Accept: application/vnd.pdk.v2+json
ParameterLocationTypeRequiredDescription
qQueryStringNoThe search query.
id_tokenHeaderStringYesA valid ID token.
info

This endpoint is versioned and requires the Accept header to work properly.

Response

The response contains an array of entities matching the search query.

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

[
{
"_id": "649d9ca6e5adcb0001f2678f",
"type": "ou",
"name": "Test Customer"
},
{
"_id": "1234ABC",
"type": "panel",
"name": "Test Panel"
}
]
PropertyTypeDescription
_idStringThe ID of the customer or cloud node.
typeStringThe entity type. Possible values include ou for customers and panel for cloud nodes.
nameStringThe name of the customer or cloud node.

Customers

Create a customer

Request

POST https://accounts.pdk.io/api/ous/{{dealer_id}}/children HTTP/1.1
Authorization: Bearer {{id_token}}
Content-Type: application/json

{
"name": "Test Customer"
}
ParameterLocationTypeRequiredDescription
dealer_idPathStringYesThe organization ID of the dealer.
id_tokenHeaderStringYesA valid ID token.
nameBodyStringYesThe customer name.
useBluetoothCredentialsBodyBooleanNoWhether Bluetooth credentials should be enabled for the organization. The default is true.
useTouchMobileAppBodyBooleanNoWhether mobile credentials should be enabled for the organization. The default value is false.
allowCredentialResetsBodyBooleanNoWhether credential self-help should be enabled for the organization. The default value is true.

Response

The response contains the newly created organization object. Note that not all available properties are included in the response.

HTTP/1.1 201 Created
Content-Type: application/json

{
"id": "64398c446e22d40001eeaf34",
"name": "Test Customer",
"allowCredentialResets": true,
"children": [],
"panels": [],
"readers": [],
"permissions": []
}

Retrieve a customer

Request

GET https://accounts.pdk.io/api/ous/{{customer_id}} HTTP/1.1
Authorization: Bearer {{id_token}}
ParameterLocationTypeRequiredDescription
customer_idPathStringYesThe organization ID of the customer.
id_tokenHeaderStringYesA valid ID token.

Response

The response contains an organization object.

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

{
"id": "64398c446e22d40001eeaf34",
"name": "Test Customer",
"useBluetoothCredentials": true,
"useTouchMobileApp": true,
"allowCredentialResets": true,
"ancestors": ["544557759a01deb9874c02ef", "55ca2050bbed06f4348b26e8"],
"parent": "55ca2050bbed06f4348b26e8",
"panels": [
{
"id": "1234DEF",
"name": "Test Panel",
"online": true,
"allowCredentialResets": true,
"credentialResetsPerMonth": 1,
"reportBillingPolicy": "basic",
"uri": "https://panel-1234DEF.pdk.io/",
"registeredDate": "2023-05-01T14:42:36.220Z"
}
],
"readers": [
{
"_id": "032500000001773C",
"deviceId": 1,
"type": "red",
"panelId": "1234DEF"
}
],
"userPermissionLevel": "admin",
"parentPermissionLevel": "guest",
"permissions": [
{
"userId": "644a19ba6e22d40001eec732",
"_id": "644a19ba6e22d40001eec733",
"email": "john@example.com",
"name": "John Wiegand",
"role": "admin"
}
]
}

Update a customer

Request

PUT https://accounts.pdk.io/api/ous/{{dealer_id}}/children/{{customer_id}} HTTP/1.1
Authorization: Bearer {{id_token}}
Content-Type: application/json

{
"name": "Test Customer"
}
ParameterLocationTypeRequiredDescription
dealer_idPathStringYesThe organization ID of the dealer.
customer_idPathStringYesThe organization ID of the customer.
id_tokenHeaderStringYesA valid ID token.
nameBodyStringYesThe customer name.
useBluetoothCredentialsBodyBooleanNoWhether Bluetooth credentials should be enabled for the organization. The default is true.
useTouchMobileAppBodyBooleanNoWhether mobile credentials should be enabled for the organization. The default value is false.
allowCredentialResetsBodyBooleanNoWhether credential self-help should be enabled for the organization. The default value is true.

Response

HTTP/1.1 204 No Content

Delete a customer

Request

DELETE https://accounts.pdk.io/api/ous/{{dealer_id}}/children/{{customer_id}} HTTP/1.1
Authorization: Bearer {{id_token}}
ParameterLocationTypeRequiredDescription
dealer_idPathIntegerYesThe organization ID of the dealer.
customer_idPathIntegerYesThe organization ID of the customer.
id_tokenHeaderStringYesA valid ID token.

Response

HTTP/1.1 204 No Content

List all customers

Request

GET https://accounts.pdk.io/api/ous/{{dealer_id}}/children HTTP/1.1
Authorization: Bearer {{id_token}}
ParameterLocationTypeRequiredDescription
dealer_idPathStringYesThe organization ID of the dealer.
id_tokenHeaderStringYesA valid ID token.

Response

The response contains an array of organization objects.

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

[
{
"id": "64398c446e22d40001eeaf34",
"name": "Test Customer",
"useBluetoothCredentials": true,
"useTouchMobileApp": true,
"allowCredentialResets": true,
"ancestors": ["544557759a01deb9874c02ef", "55ca2050bbed06f4348b26e8"],
"parent": "55ca2050bbed06f4348b26e8",
"children": [],
"panels": [
{
"id": "1234DEF",
"name": "Test Panel",
"online": true,
"allowCredentialResets": true,
"credentialResetsPerMonth": 1,
"reportBillingPolicy": "basic",
"uri": "https://panel-1234DEF.pdk.io/",
"registeredDate": "2023-05-01T14:42:36.220Z"
}
],
"readers": [
{
"_id": "032500000001773C",
"deviceId": 1,
"type": "red",
"panelId": "1234DEF"
}
],
"userPermissionLevel": "admin",
"parentPermissionLevel": "guest",
"permissions": [
{
"userId": "644a19ba6e22d40001eec732",
"_id": "644a19ba6e22d40001eec733",
"email": "john@example.com",
"name": "John Wiegand",
"role": "admin"
}
]
}
]