List Active Directory computers

List properties and relationships of the directoryComputer objects.

HTTP Request

POST /directoryComputers

Request headers

HeaderValue
AuthorizationIf required by Centero Agent Gateway configuration
KeyAuthentication key if required by Centero Agent Gateway configuration. Key can be passed also as URI parameter (like: /computerManagedGroupRules?Key=configuredkey)
Acceptapplication/json

Request Parameters

Following table shows the parameters available for the request.

ParameterTypeDescription
KeystringOptional. Authentication key if required by Centero Agent Gateway configuration. Can be passed also as request header
PageSizeintOptional. Number of computers to return on each request. Default is zero (0) that returns all computers. If PageSize is set you need to specify also PageOffset value. Can be passed also in request body
PageOffsetintOptional. Offset for page to retrieve. First page is one (1). If Offset is set you need to specify also PageSize. Can be passed also in request body. Example combinations:
  • PageSize = 100 and PageOffset = 1: retrieves 100 first computers (1-100)
  • PageSize = 100 and PageOffset = 3: retrieves computers 201-300

Request Body

In the request body, supply a JSON representation for performing Active Directory search. Following table shows the properties that are available when you list computers from Active Directory.

PropertyTypeDescription
UseGlobalCatalogboolTo use Active Directory Global Catalog for searching computers.
SearchRootstringActive Directory distinguished name of the domain, organization unit or container where to search for computer objects. Search is always done to the search root and all organization units and containers below it.
SortPropertystringSpecify AD attribute for ordering the results. Empty or null value does not use ordering
SortDirectionstringIf SortProperty is specified then specify ordering direction. Allowed values:
  • Asc
  • Desc

If empty or null then ascending ordering will be used

FilterstringCustom LDAP filter to use. Default filter if not set is: (&(objectClass=computer))
PageSizeintNumber of computers to return on each request. Default is zero (0) that returns all computers. If PageSize is set you need to specify also PageOffset value. Can be passed also in request parameters and if specified in both then value from request parameters is used.
PageOffsetintOffset for page to retrieve. First page is one (1). If Offset is set you need to specify also PageSize. Can be passed also in request parameters and if specified in both then value from request parameters is used. Example combinations:
  • PageSize = 100 and PageOffset = 1: retrieves 100 first computers (1-100)
  • PageSize = 100 and PageOffset = 3: retrieves computers 201-300
ReturnAttributesstring arrayList of attributes to return from all found computers.

Response

If successful, this method returns a 200 OK response code and a collection of directoryComputer objects in the response body.

Example

Request

Here is an example of the request.

POST https://cgw.dns.domain/api/v1.0/directoryComputers?Pagesize=100&PageOffset=1
Content-Type: application/json
{
    "UseGlobalCatalog": false,
    "SearchRoot": "OU=Workstations,DC=domain,DC=ad",
    "SortProperty": "whenCreated",
    "SortDirection": "Desc",
    "Filter": "(&(objectClass=computer))",
    "ReturnAttributes": [
        "description",
        "name"
    ]
}

Response

HTTP/1.1 200 OK
Content-Type: application/json
[
    {
        "Guid": "91eba3a1-a803-4a22-b57f-94af33d1eda9",
        "NativeGuid": "a1a3eb9103a8224ab57f94af33d1eda9",
        "Path": "LDAP://CN=COMPUTER1,OU=Workstations,DC=domain,DC=ad",
        "Attributes": {
            "description": "John Doe laptop",
            "name": "COMPUTER1"
        }
    },
    {
        "Guid": "2e7c8044-a2ce-41eb-ab01-3cb1ccca0ec1",
        "NativeGuid": "44807c2ecea2eb41ab013cb1ccca0ec1",
        "Path": "LDAP://CN=COMPUTER2,OU=Workstations,DC=domain,DC=ad",
        "Attributes": {
            "description": "John Doe DESKTOP",
            "name": "COMPUTER2"
        }
    }
]