Operations (sample payloads)

Main operations

Add

Perform an LDAP add operation. Sample Input

{
    "username": "admin",
    "password": "secretpassword",
    "base_dn": "dc=example,dc=com",
    "host": \{
        "url": "ldap://ldap.example.com",
        "port": 389
    \},
    "dn": "cn=John Doe,ou=Users",
    "append_base_dn": true,
    "entry": \{
        "objectClass": [
            "inetOrgPerson",
            "organizationalPerson",
            "person"
        ],
        "cn": "John Doe",
        "sn": "Doe",
        "givenName": "John",
        "mail": "john.doe@example.com",
        "userPassword": "initialPassword123"
    \}
}

Sample Output

{
    "success": true
}

Batch get by DNs

Get a batch of objects from a list of DNs. Sample Input

{
    "username": "admin",
    "password": "secretpassword",
    "base_dn": "dc=example,dc=com",
    "host": \{
        "url": "ldap://ldap.example.com",
        "port": 389
    \},
    "dns": [
        "cn=John Doe,ou=Users,dc=example,dc=com",
        "cn=Jane Smith,ou=Users,dc=example,dc=com"
    ],
    "attributes": [
        "cn",
        "sn",
        "givenName",
        "mail",
        "userPrincipalName"
    ]
}

Sample Output

{
    "results": [
        \{
            "dn": "cn=John Doe,ou=Users,dc=example,dc=com",
            "controls": [],
            "objectClass": [
                "top",
                "person",
                "organizationalPerson",
                "user"
            ],
            "cn": "John Doe",
            "sn": "Doe",
            "givenName": "John",
            "distinguishedName": "cn=John Doe,ou=Users,dc=example,dc=com",
            "instanceType": "4",
            "whenCreated": "20230101000000.0Z",
            "whenChanged": "20230615120000.0Z",
            "displayName": "John Doe",
            "uSNCreated": "12345",
            "memberOf": "cn=Sales,ou=Groups,dc=example,dc=com",
            "uSNChanged": "67890",
            "name": "John Doe",
            "objectGUID": "f7e5a912-8b3c-4f20-a65d-3a3b7e567890",
            "userAccountControl": "512",
            "badPwdCount": "0",
            "codePage": "0",
            "countryCode": "0",
            "badPasswordTime": "0",
            "lastLogoff": "0",
            "lastLogon": "132951234567890000",
            "pwdLastSet": "132950000000000000",
            "primaryGroupID": "513",
            "objectSid": "S-1-5-21-3623811015-3361044348-30300820-1013",
            "accountExpires": "9223372036854775807",
            "logonCount": "42",
            "sAMAccountName": "jdoe",
            "sAMAccountType": "805306368",
            "userPrincipalName": "jdoe@example.com",
            "objectCategory": "cn=Person,cn=Schema,cn=Configuration,dc=example,dc=com",
            "dSCorePropagationData": [
                "16010101000000.0Z"
            ],
            "mail": "john.doe@example.com"
        \},
        \{
            "dn": "cn=Jane Smith,ou=Users,dc=example,dc=com",
            "controls": [],
            "objectClass": [
                "top",
                "person",
                "organizationalPerson",
                "user"
            ],
            "cn": "Jane Smith",
            "sn": "Smith",
            "givenName": "Jane",
            "distinguishedName": "cn=Jane Smith,ou=Users,dc=example,dc=com",
            "instanceType": "4",
            "whenCreated": "20230201000000.0Z",
            "whenChanged": "20230614150000.0Z",
            "displayName": "Jane Smith",
            "uSNCreated": "23456",
            "memberOf": "cn=Marketing,ou=Groups,dc=example,dc=com",
            "uSNChanged": "78901",
            "name": "Jane Smith",
            "objectGUID": "a1b2c3d4-5e6f-7g8h-9i0j-1k2l3m4n5o6p",
            "userAccountControl": "512",
            "badPwdCount": "0",
            "codePage": "0",
            "countryCode": "0",
            "badPasswordTime": "0",
            "lastLogoff": "0",
            "lastLogon": "132952345678901000",
            "pwdLastSet": "132951000000000000",
            "primaryGroupID": "513",
            "objectSid": "S-1-5-21-3623811015-3361044348-30300820-1014",
            "accountExpires": "9223372036854775807",
            "logonCount": "37",
            "sAMAccountName": "jsmith",
            "sAMAccountType": "805306368",
            "userPrincipalName": "jsmith@example.com",
            "objectCategory": "cn=Person,cn=Schema,cn=Configuration,dc=example,dc=com",
            "dSCorePropagationData": [
                "16010101000000.0Z"
            ],
            "mail": "jane.smith@example.com"
        \}
    ]
}

Delete

Perform an LDAP delete operation. Sample Input

{
    "username": "admin",
    "password": "secretpassword",
    "base_dn": "dc=example,dc=com",
    "host": \{
        "url": "ldap://ldap.example.com",
        "port": 389
    \},
    "dn": "cn=John Doe,ou=Users",
    "append_base_dn": true
}

Sample Output

{
    "success": true
}

Modify

Perform an LDAP modify operation. Sample Input

{
    "username": "admin",
    "password": "secretpassword",
    "base_dn": "dc=example,dc=com",
    "host": \{
        "url": "ldap://ldap.example.com",
        "port": 389
    \},
    "dn": "cn=John Doe,ou=Users",
    "append_base_dn": true,
    "modify_type": "replace",
    "entry": \{
        "mail": "johndoe@example.com",
        "telephoneNumber": "+1-555-123-4567"
    \}
}

Sample Output

{
    "success": true
}

Modify DN

Modify the DN of an entry. Sample Input

{
    "username": "admin",
    "password": "secretpassword",
    "base_dn": "dc=example,dc=com",
    "host": \{
        "url": "ldap://ldap.example.com",
        "port": 389
    \},
    "dn": \{
        "dn": "cn=John Doe,ou=Users",
        "append_base_dn": true
    \},
    "new_dn": \{
        "dn": "cn=John Doe,ou=Employees",
        "append_base_dn": true
    \}
}

Sample Output

{
    "success": true
}

Perform an LDAP search operation. Sample Input

{
    "username": "admin",
    "password": "secretpassword",
    "base_dn": "dc=example,dc=com",
    "host": \{
        "url": "ldap://ldap.example.com",
        "port": 389
    \},
    "append_base_dn": true,
    "initial_filter": \{
        "field": "objectClass",
        "condition": "Equals",
        "value": "person"
    \},
    "further_filters": [
        \{
            "field": "sn",
            "condition": "Equals",
            "value": "Smith"
        \}
    ],
    "conjunction": "&",
    "scope": "sub",
    "return_type": [
        "cn",
        "mail",
        "telephoneNumber"
    ],
    "return_as_file": false
}

Sample Output

{
    "results": [
        \{
            "dn": "cn=John Smith,ou=People,dc=example,dc=com",
            "controls": [],
            "cn": "John Smith",
            "mail": "john.smith@example.com",
            "telephoneNumber": "+1 555-123-4567"
        \},
        \{
            "dn": "cn=Jane Smith,ou=People,dc=example,dc=com",
            "controls": [],
            "cn": "Jane Smith",
            "mail": "jane.smith@example.com",
            "telephoneNumber": "+1 555-987-6543"
        \}
    ],
    "count": 2,
    "total": 2
}

Search Raw

Perform an LDAP search operation Sample Input

{
    "username": "ldap_user",
    "password": "password123",
    "base_dn": "dc=example,dc=com",
    "host": \{
        "url": "ldap://ldap.example.com",
        "port": 389
    \},
    "append_base_dn": true,
    "filter": "(objectClass=person)",
    "scope": "sub",
    "return_type": [
        "cn",
        "mail",
        "givenName",
        "sn"
    ],
    "return_as_file": false
}

Sample Output

{
    "results": [
        \{
            "dn": "cn=John Doe,ou=Users,dc=example,dc=com",
            "controls": [],
            "givenName": "John",
            "cn": "John Doe",
            "mail": "john.doe@example.com",
            "sn": "Doe"
        \},
        \{
            "dn": "cn=Jane Smith,ou=Users,dc=example,dc=com",
            "controls": [],
            "givenName": "Jane",
            "cn": "Jane Smith",
            "mail": "jane.smith@example.com",
            "sn": "Smith"
        \}
    ],
    "count": 2,
    "total": 2
}

Was this page helpful?