Skip to main content
Version: 2.0

Organizations

Introduction

Organizations are hierarchical containers of permissions. Parent organizations represent PDK dealers while child organizations represent their customers. You can learn more about the PDK topology here. Note that the API sometimes refers to organizations as OUs (organizational units).

info

The easiest way to distinguish between dealers and customers is to inspect the ancestors property. Dealers will only have one ancestor while customers will have two ancestors.

The organization object

{
"id": "64398c446e22d40001eeaf34",
"name": "Test Dealer",
"useBluetoothCredentials": true,
"useTouchMobileApp": true,
"allowCredentialResets": true,
"ancestors": ["544557759a01deb9874c02ef"],
"parent": "544557759a01deb9874c02ef",
"children": [
{
"id": "6512e8f4dd7de8191957fcc1",
"name": "Test Customer",
"systemId": "b7e83c7d-2ff0-4b94-9275-08b31ee04fc0",
"useBluetoothCredentials": true,
"useTouchMobileApp": true,
"allowCredentialResets": true
}
],
"panels": [],
"userPermissionLevel": "admin",
"parentPermissionLevel": "guest",
"permissions": [
{
"_id": "644a19ba6e22d40001eec733",
"userId": "644a19ba6e22d40001eec732",
"email": "john@example.com",
"name": "John Wiegand",
"role": "admin"
}
]
}
PropertyTypeDescription
idStringThe organization ID.
nameStringThe organization name.
systemIdStringThe system ID. If a system ID is not present, then the organization represents either a dealer or a legacy customer.
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 customers.
children.idStringThe customer organization ID.
children.nameStringThe customer name.
children.systemIdStringThe customer system ID. If a system ID is not present, the the organization represents a legacy customer.
children.useBluetoothCredentialsBooleanWhether Bluetooth credentials are enabled for the customer.
children.useTouchMobileAppBooleanWhether mobile credentials are enabled for the customer.
children.allowCredentialResetsBooleanWhether credential self-help is enabled for the customer.
panelsObject[]A list of cloud nodes associated with the organization.
panels.uuidStringThe cloud node ID.
panels.nameStringThe cloud node name.
panels.idStringThe cloud node serial number.
panels.registeredDateStringAn ISO 8601 timestamp representing the time at which the cloud node was registered.
panels.onlineBooleanWhether the cloud node is online.
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/organizations/{{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": "6512e8f4dd7de8191957fcc1",
"name": "Test Customer",
"systemId": "b7e83c7d-2ff0-4b94-9275-08b31ee04fc0",
"useBluetoothCredentials": true,
"useTouchMobileApp": true,
"allowCredentialResets": true
}
],
"panels": [],
"userPermissionLevel": "admin",
"parentPermissionLevel": "guest",
"permissions": [
{
"_id": "644a19ba6e22d40001eec733",
"userId": "644a19ba6e22d40001eec732",
"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/organizations/{{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": "6512e8f4dd7de8191957fcc1",
"type": "ou",
"name": "Test Customer",
"systemId": "b7e83c7d-2ff0-4b94-9275-08b31ee04fc0"
},
{
"_id": "1234ABC",
"type": "panel",
"name": "Test Cloud Node",
"uuid": "7d829ff4-53e8-4d76-8762-1022ccdeae39",
"systemId": "b7e83c7d-2ff0-4b94-9275-08b31ee04fc0"
}
]
PropertyTypeDescription
_idStringThe customer ID or cloud node serial number.
typeStringThe entity type. Possible values include ou for customers and panel for cloud nodes.
nameStringThe name of the customer or cloud node.
uuidStringThe cloud node ID.
systemIdStringThe system ID.

List all my organizations

Request

GET https://accounts.pdk.io/api/organizations/mine HTTP/1.1
Authorization: Bearer {{id_token}}
ParameterLocationTypeRequiredDescription
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 Dealer",
"useBluetoothCredentials": true,
"useTouchMobileApp": true,
"allowCredentialResets": true,
"ancestors": ["544557759a01deb9874c02ef"],
"parent": "544557759a01deb9874c02ef",
"children": [
{
"id": "6512e8f4dd7de8191957fcc1",
"name": "Test Customer",
"systemId": "b7e83c7d-2ff0-4b94-9275-08b31ee04fc0",
"useBluetoothCredentials": true,
"useTouchMobileApp": true,
"allowCredentialResets": true
}
],
"panels": [],
"userPermissionLevel": "admin",
"parentPermissionLevel": "guest",
"permissions": [
{
"_id": "644a19ba6e22d40001eec733",
"userId": "644a19ba6e22d40001eec732",
"email": "john@example.com",
"name": "John Wiegand",
"role": "admin"
}
]
},
{
"id": "6512e8f4dd7de8191957fcc1",
"name": "Test Customer",
"systemId": "b7e83c7d-2ff0-4b94-9275-08b31ee04fc0",
"useBluetoothCredentials": true,
"useTouchMobileApp": true,
"allowCredentialResets": true,
"ancestors": ["544557759a01deb9874c02ef"],
"parent": "544557759a01deb9874c02ef",
"children": [],
"panels": [
{
"uuid": "7d829ff4-53e8-4d76-8762-1022ccdeae39",
"name": "Test Panel",
"id": "1234ABC",
"registeredDate": "2023-09-27T22:21:56.865Z",
"online": true
}
],
"userPermissionLevel": "admin",
"parentPermissionLevel": "guest",
"permissions": []
}
]

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/organizations/mine/search?q=test HTTP/1.1
Authorization: Bearer {{id_token}}
ParameterLocationTypeRequiredDescription
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": "6512e8f4dd7de8191957fcc1",
"type": "ou",
"name": "Test Customer",
"systemId": "b7e83c7d-2ff0-4b94-9275-08b31ee04fc0"
},
{
"_id": "1234ABC",
"type": "panel",
"name": "Test Cloud Node",
"uuid": "7d829ff4-53e8-4d76-8762-1022ccdeae39",
"systemId": "b7e83c7d-2ff0-4b94-9275-08b31ee04fc0"
}
]
PropertyTypeDescription
_idStringThe customer ID or cloud node serial number.
typeStringThe entity type. Possible values include ou for customers and panel for cloud nodes.
nameStringThe name of the customer or cloud node.
uuidStringThe cloud node ID.
systemIdStringThe system ID.

Customers

Create a customer

Creating a new customer will automatically create a corresponding system.

Request

POST https://accounts.pdk.io/api/organizations/{{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.
typeBodyStringNoWhich architecture should be used. Possible values include multi-site (default) for the 2.0 architecture and legacy for the 1.0 architecture. If omitted or set to multi-site, a system will automatically be created.

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",
"systemId": "b7e83c7d-2ff0-4b94-9275-08b31ee04fc0",
"allowCredentialResets": true,
"children": [],
"panels": [],
"permissions": []
}

Retrieve a customer

Request

GET https://accounts.pdk.io/api/organizations/{{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": "6512e8f4dd7de8191957fcc1",
"name": "Test Customer",
"systemId": "b7e83c7d-2ff0-4b94-9275-08b31ee04fc0",
"useBluetoothCredentials": true,
"useTouchMobileApp": true,
"allowCredentialResets": true,
"ancestors": ["544557759a01deb9874c02ef"],
"parent": "544557759a01deb9874c02ef",
"children": [],
"panels": [
{
"uuid": "7d829ff4-53e8-4d76-8762-1022ccdeae39",
"name": "Test Panel",
"id": "1234ABC",
"registeredDate": "2023-09-27T22:21:56.865Z",
"online": true
}
],
"userPermissionLevel": "admin",
"parentPermissionLevel": "guest",
"permissions": []
}

Update a customer

Request

PUT https://accounts.pdk.io/api/organizations/{{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/organizations/{{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/organizations/{{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": "6512e8f4dd7de8191957fcc1",
"name": "Test Customer",
"systemId": "b7e83c7d-2ff0-4b94-9275-08b31ee04fc0",
"useBluetoothCredentials": true,
"useTouchMobileApp": true,
"allowCredentialResets": true,
"ancestors": ["544557759a01deb9874c02ef"],
"parent": "544557759a01deb9874c02ef",
"children": [],
"panels": [
{
"uuid": "7d829ff4-53e8-4d76-8762-1022ccdeae39",
"name": "Test Panel",
"id": "1234ABC",
"registeredDate": "2023-09-27T22:21:56.865Z",
"online": true
}
],
"userPermissionLevel": "admin",
"parentPermissionLevel": "guest",
"permissions": []
}
]