Count Object


title: “Count Object”

Count the number of objects of a specific type within a folder. Useful for pagination planning, dashboard statistics, and capacity monitoring.


Method Signature

Task<long> GetObjectCountsAsync(
    FolderInfo folder,
    string typeName,
    bool includeChildFolders = false
)

Parameters

Parameter Type Description
folder FolderInfo The folder to count objects in
typeName string Object type name (without “Info” suffix)
includeChildFolders bool Include child folder objects

Type Name Mapping

Important: Use the type name without the “Info” suffix. The exception is BaseInfo, which uses KeepObject.

C# Class Type Name
PersonInfo Person
ControllerInfo Controller
ReaderInfo Reader
AccessLevelInfo AccessLevel
ScheduleInfo Schedule
EventMessageInfo EventMessage
BaseInfo KeepObject

Examples

C# Wrapper

// Count people in an instance
var personCount = await client.GetObjectCountsAsync(instance, "Person");
Console.WriteLine($"Total cardholders: {personCount}");

// Count controllers including child folders
var controllerCount = await client.GetObjectCountsAsync(
    rootInstance, 
    "Controller", 
    includeChildFolders: true
);

// Count for pagination
var totalPeople = await client.GetObjectCountsAsync(instance, "Person");
var pageSize = 100;
var totalPages = (int)Math.Ceiling((double)totalPeople / pageSize);

for (int page = 0; page < totalPages; page++)
{
    var people = await client.GetPeopleAsync(instance, page * pageSize, pageSize);
    // Process page...
}

cURL

curl -X GET \
  "https://api.acresecurity.cloud/api/f/{instance-key}/count?typeName=Person&includeChildFolders=false" \
  -H "Authorization: Bearer TOKEN_GOES_HERE"

Use Cases

Use Case Example
Dashboard statistics Count controllers, readers, cardholders
Pagination planning Calculate total pages before fetching
License monitoring Count active cardholders vs license limit
Health checks Verify expected object counts

Get Call Count

Example in C#

// Returns: Int64
var item = client.CallCount;

Overview of get_CallCount goes here.

Get Next Counter Async

Example in C#

// Returns: Int32
var item = await client.GetNextCounterAsync(FolderInfo folder);

Overview of GetNextCounterAsync goes here.

Get Object Counts Async

Example in C#

// Returns: Int64
var item = await client.GetObjectCountsAsync(FolderInfo folder, String typeName, Boolean includeChildFolders);

title: “GetObjectCountsAsync”

Count objects of a specific type within a folder. Returns a long value representing the total count.


Method Signature

Task<long> GetObjectCountsAsync(
    FolderInfo folder,
    string typeName,
    bool includeChildFolders = false
)

Parameters

Parameter Type Description
folder FolderInfo The folder to count objects in
typeName string Object type name (without “Info” suffix)
includeChildFolders bool Include objects in child folders

Type Name Reference

C# Class Type Name
PersonInfo Person
ControllerInfo Controller
ReaderInfo Reader
AccessLevelInfo AccessLevel
ScheduleInfo Schedule
BaseInfo KeepObject

Examples

C# Wrapper

// Count people in instance
var personCount = await client.GetObjectCountsAsync(instance, "Person");
Console.WriteLine($"Total cardholders: {personCount}");

// Count controllers across all child folders
var controllerCount = await client.GetObjectCountsAsync(
    rootInstance, 
    "Controller", 
    includeChildFolders: true
);

// Pagination calculation
var total = await client.GetObjectCountsAsync(instance, "Person");
var pageSize = 100;
var pages = (int)Math.Ceiling((double)total / pageSize);

for (int page = 0; page < pages; page++)
{
    var people = await client.GetPeopleAsync(instance, page * pageSize, pageSize);
    // Process page...
}

cURL

curl -X GET \
  "https://api.acresecurity.cloud/api/f/{instance-key}/count?typeName=Person&includeChildFolders=false" \
  -H "Authorization: Bearer TOKEN_GOES_HERE"

Use Cases

Use Case Description
Dashboard stats Display object counts on dashboards
Pagination Calculate total pages before fetching
License check Count cardholders against license limits
Health monitoring Track object counts over time

Get Unread Notification Count For User Async

Example in C#

// Returns: Int32
var item = await client.GetUnreadNotificationCountForUserAsync(FolderInfo folder, UserInfo user, DateTime beforeStartDate, DateTime beforeEndDate, DateTime afterStartDate, DateTime afterEndDate);

Overview of GetUnreadNotificationCountForUserAsync goes here.

Increment Execution Count

Example in C#

// Returns: nothing
await client.IncrementExecutionCount(FitScriptExecSpecInfo item);

Overview of IncrementExecutionCount goes here.

Increment Install Count

Example in C#

// Returns: nothing
await client.IncrementInstallCount(MarketplacePackageInfo item);

Overview of IncrementInstallCount goes here.