Tenant Tree

A Tenant Tree is a flattened representation of the whole hierachy including Tenant, recursive Units and its Managers (User), Unit Tenant and its Managers and Agents which are essentially (Users).

Graphical Tenant Tree Representation

..tree:

+ Tenant
|
|---+ Unit (recursive)
    | Unit manager(s)
    |
    |---+ Team
        | Team manager(s)
        | Agent(s)

Tenant Tree Item Model

Represent the Tenant Tree model as flattened hierarchy with read-only properties.

Note

Note that model is used as result of read-only method GET (GetTree).

Name Description Type
id Representing Tenan Tree Item identifier. guid
Common properties
treeItemId The id of Tenant, Unit, Team or User. guid
treeItemType The item type. Tenant, Unit, Team or User. string
name The name of Tenant, Unit, Team or User. string
isActive Denotes whether the Tenant Tree Item state is active or inactive. boolean
isDeleted Denotes whether the Tenant Tree Item state is deleted or not. boolean
User specific
recorderUserId The User identification of media files within the Recorder. string
recorderUserId The User identification of media files within the Recorder. string
haveRecorder Denotes whether the [Recorder](/v1/recorder) is assigned to User. boolean
Manager / Agent specific
managerOrAgentId Representing the true identifier of managership/membership not only the userId. guid
Tenant specific
tenantId Sets to each Tenant Tree Item tenantId to denote which Tenant it belongs. guid

Note

The Tenant Tree properties names (Name column) is for default usage by JSON, for C# Wrapper usage the Tenant Tree properties are capitalized (eg. Id, Name,..)!

Tenant Tree Item Types

Currently supported [Tenant Tree](/v1/tree) item types are:

  • Tenant
  • Unit
  • Unit Manager
  • Team
  • Team Manager
  • Agent

Levels and Tenant Tree Item Types

[Schedule](/v1/schedule) levels are essentially a Tenant Tree items. But only tree items that are of type Unit, Team or Agent are valid as Schedule levels, other tree item types are invalid!

Tenant Tree Item

The root [Te:ref:tenant-label tree item with recursive items.

Default REST approach

GET /api/v1/:tenantCode/tree

Parameters

  • tenantCode Tenant code, a valid integer greater or equal to 1000.

Danger

Remember to add API Key as customer*key and API Secret as customer*secret into your Request HTTP Header. See more in Getting Started.

Return value

  • If there is no error: JSON [Tenant Tree Item Model](/v1/tree#tenant-tree-item-model).
  • If there is an error: JSON Client Errors object.

C# Wrapper approach

1
TreeWrapper(int tenantCode, string apiKey, string apiSecret).GetTree();

Parameters

  • tenantCode Tenant code, a valid integer greater or equal to 1000.
  • apiKey Tenant API Key provided by Qualtrak.
  • apiSecret Tenant API Secret provided by Qualtrak.

Return value

  • If there is no error: ResaultContent<TenantTreeItem>.Result object as [Tenant Tree Item Model](/v1/tree#tenant-tree-item-model).
  • If there is an error: ResaultContent<TenantTreeItem>.Error object. See more in Client Errors.

Example usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
int tenantCode = 1000;
string key = "ddZXdAZvWefFqxAEH62u";
string secret = "wx6GiQggg9YRH89XT5aKoY2qZLVquYjxARtgZhuGoFQX5w6Lws";

TreeWrapper treeWrapper = new TreeWrapper(tenantCode, key, secret);
ResponseContent<TenantTreeItem> response = treeWrapper.GetTree();

if (response.Result != null)
{
     // Use Result as root Tenant Tree Item.
     TenantTreeItem rootTenantItem = response.Result;

     // Root Units can be invoked
     ICollection<TenantTreeItem> rootUnits = rootTenantItem.Items;

     // .... use recursion to get full hierarchy for displaying
}
else
{
    // TODO: The error handling...
    Console.WriteLine(response.Error);
}