Skip to main content

Listing Records

Use SearchAsync to retrieve paginated lists of records from any entity endpoint.

List the first page

Retrieve the first page with the default page size (25):
var endpoint = new CoworkerEndpoint(client);
SearchResult<Coworker> result = await endpoint.SearchAsync();

foreach (var c in result.Records)
    Console.WriteLine($"{c.Id}: {c.FullName}");

Custom page size

Specify a page number and page size:
SearchResult<Coworker> result = await endpoint.SearchAsync(page: 1, size: 10);

Console.WriteLine($"Page {result.CurrentPage} of {result.TotalPages}");
Console.WriteLine($"Showing {result.Records.Count} of {result.TotalItems} records");

Iterate all pages

Loop through every page to process all records:
int page = 1;
int totalPages;

do
{
    var result = await endpoint.SearchAsync(page: page, size: 25);
    totalPages = result.TotalPages;

    foreach (var c in result.Records)
        Console.WriteLine($"{c.Id}: {c.FullName}");

    page++;
} while (page <= totalPages);

SearchResult properties

The SearchResult<T> object returned by SearchAsync provides full pagination metadata:
PropertyTypeDescription
RecordsList<T>The records on the current page.
CurrentPageintThe current page number (1-based).
PageSizeintThe number of records per page.
TotalItemsintTotal number of matching records.
TotalPagesintTotal number of pages available.

Sorting results

Pass orderBy and dir parameters to control the sort order:
var endpoint = new BookingEndpoint(client);

// Sort by FromTime descending
var result = await endpoint.SearchAsync(orderBy: "FromTime", dir: 1);
ParameterTypeDescription
orderBystringThe property name to sort by (e.g., "FromTime").
dirintSort direction: 0 = ascending, 1 = descending.
If omitted, the API uses each entity’s default sort order (e.g., Bookings default to FromTime ascending, Coworkers default to FullName ascending).

Sorting with filters

Sorting can be combined with filters and pagination:
var filters = new Dictionary<string, string>
{
    ["Booking_Resource"] = "98765"
};

var result = await endpoint.SearchAsync(filters, page: 1, size: 50, orderBy: "FromTime", dir: 1);

Sorting with typed search filters

Typed search filter classes also expose OrderBy and Dir properties:
var filters = new BookingSearchFilters
{
    ResourceId = 98765,
    OrderBy = "FromTime",
    Dir = 1 // descending
};

var result = await endpoint.SearchAsync(filters);

Works with any entity

The same pattern applies to every endpoint in the SDK:
var bookings = await new BookingEndpoint(client).SearchAsync();
var products = await new ProductEndpoint(client).SearchAsync();
var businesses = await new BusinessEndpoint(client).SearchAsync();