List Active Directory Computers

List properties and relationships of the directory Computer 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 the Recast Agent Gateway configuration. Can be passed also as a request header
$topintOptional. Number of computers to return on each request. Default is zero (0) that returns all computers
$skipintOptional. Number of items to skip. If this value is set you need to specify also $top. Example combinations:
  • $top = 100 and $skip = 0: retrieves 100 first computers (1-100)
  • $top = 100 and $skip = 200: 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 the SortProperty is specified then specify the 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))
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 directory Computer objects in the response body.

Example

Request

Here is an example of the request.

POST https://cgw.dns.domain/api/v1.0/directoryComputers?$top=2&$skip=0
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
{
    "@odata.context": "https://cgw.dns.domain/$metadata#directoryComputers",
    "@odata.nextLink": "https://cgw.dns.domain/api/v1.0/directoryComputers?$top=2&$skip=2",
    "value": [
        {
            "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"
            }
        }
    ]
}
Copyright © 2024 Recast Software Inc. All rights reserved.