Search for Entries in a Directory
You can use the GET
method and specify where and what to search in the directory information tree.
http(s)://host:port/rest/v1/directory
See Send Requests.
Search for all Entries by Scope
This example shows how to search for all subtree entries in a specific container.
Submit a request to the URL using the GET
method.
http://host:port/rest/v1/directory/<directory entry DN>?scope=<scopetype>
Example
curl -i -X GET -u cn=Directory Manager:******* -H Content-type:application/json http://myhost:7001/rest/v1/directory/ou=People,dc=example,dc=com?scope=sub
The following shows an example of a response body.
{
"msgType": "urn:ietf:params:rest:schemas:oracle:oud:1.0:SearchResponse",
"totalResults": 3,
"searchResultEntries": [
{
"dn": "ou=People,dc=example,dc=com",
"attributes": {
"ou": "People",
"objectClass": [
"top",
"organizationalunit"
]
}
},
{
"dn": "uid=user.1,ou=People,dc=example,dc=com",
"attributes": {
"mail": "user.1@example.com",
"initials": "ALA",
"homePhone": "+1 280 375 4325",
"pager": "+1 850 883 8888",
"givenName": "Aaren",
"employeeNumber": "1",
"telephoneNumber": "+1 390 103 6917",
"mobile": "+1 680 734 6300",
"sn": "Atp",
"cn": "Aaren Atp",
"userPassword": "{SSHA512}password",
"description": "This is the description for Aaren Atp.",
"street": "70110 Fourth Street",
"st": "OH",
"postalAddress": "Aaren Atp$70110 Fourth Street$New Haven, OH 93694",
"l": "New Haven",
"postalCode": "93694",
"uid": "user.1",
"objectClass": [
"top",
"inetorgperson",
"organizationalperson",
"person"
]
}
},
{
"dn": "uid=user.2,ou=People,dc=example,dc=com",
"attributes": {
"mail": "user.2@example.com",
"initials": "AOA",
"homePhone": "+1 003 428 0962",
"pager": "+1 053 688 9803",
"givenName": "Aarika",
"employeeNumber": "2",
"telephoneNumber": "+1 757 462 0301",
"mobile": "+1 279 618 3901",
"sn": "Atpco",
"cn": "Aarika Atpco",
"userPassword": "{SSHA512}/password",
"description": "This is the description for Aarika Atpco.",
"street": "00900 Maple Street",
"st": "KS",
"postalAddress": "Aarika Atpco$00900 Maple Street$New Orleans, KS 10857",
"l": "New Orleans",
"postalCode": "10857",
"uid": "user.2",
"objectClass": [
"top",
"inetorgperson",
"organizationalperson",
"person"
]
}
},
{
"dn": "uid=user.3,ou=People,dc=example,dc=com",
"attributes": {
"mail": "user.3@example.com",
"initials": "AKA",
"homePhone": "+1 332 432 4295",
"pager": "+1 197 025 3730",
"givenName": "Aaron",
"employeeNumber": "3",
"telephoneNumber": "+1 094 100 7524",
"mobile": "+1 890 430 9077",
"sn": "Atrc",
"cn": "Aaron Atrc",
"userPassword": "{SSHA512}password",
"description": "This is the description for Aaron Atrc.",
"street": "59748 Willow Street",
"st": "TN",
"postalAddress": "Aaron Atrc$59748 Willow Street$Green Bay, TN 66239",
"l": "Green Bay",
"postalCode": "66239",
"uid": "user.3",
"objectClass": [
"top",
"inetorgperson",
"organizationalperson",
"person"
]
}
}
]
}
Search for all Entries by Filter
This example shows how to search all entries with the filter (objectclass=*)
.
Submit a request to the URL using the GET
method.
http://host:port/rest/v1/directory/<directory entry DN>?scope=<scopetype>&filter=<filtertype(uid)>
Example
curl -i -X GET -u cn=Directory Manager:******* -H Content-type:application/json http://myhost:7001/rest/v1/directory/ou=People,dc=example,dc=com?scope=sub&filter=(%26(objectclass=*)(uid=user.1))
The following shows an example of a response body.
{
"msgType": "urn:ietf:params:rest:schemas:oracle:oud:1.0:SearchResponse",
"totalResults": 1,
"searchResultEntries": [
{
"dn": "uid=user.1,ou=People,dc=example,dc=com",
"attributes": {
"mail": "user.1@example.com",
"initials": "ALA",
"homePhone": "+1 280 375 4325",
"pager": "+1 850 883 8888",
"givenName": "Aaren",
"employeeNumber": "1",
"telephoneNumber": "+1 390 103 6917",
"mobile": "+1 680 734 6300",
"sn": "Atp",
"cn": "Aaren Atp",
"userPassword": "{SSHA512}password",
"description": "This is the description for Aaren Atp.",
"street": "70110 Fourth Street",
"st": "OH",
"postalAddress": "Aaren Atp$70110 Fourth Street$New Haven, OH 93694",
"l": "New Haven",
"postalCode": "93694",
"uid": "user.1",
"objectClass": [
"top",
"inetorgperson",
"organizationalperson",
"person"
]
}
}
]
}
Search for a Specific User Entry
This example shows how to search a specific user entry (uid:user.1
):
Submit a request to the URL using the GET
method.
http://host:port/rest/v1/directory/uid=<uid>,<directory entry DN>?scope=<scopetype>
Example
curl -i -X GET -u cn=Directory Manager:******* -H Content-type:application/json http://myhost:7001/rest/v1/directory/uid=user1,ou=People,dc=example,dc=com?scope=sub
The following shows an example of the response.
{
"msgType": "urn:ietf:params:rest:schemas:oracle:oud:1.0:SearchResponse",
"totalResults": 1,
"searchResultEntries": [
{
"dn": "uid=user.1,ou=People,dc=example,dc=com",
"attributes": {
"mail": "user.1@example.com",
"initials": "MG",
"homePhone": "+1 280 375 4325",
"pager": "+1 850 883 8888",
"givenName": "Marcia Garza",
"employeeNumber": "1",
"telephoneNumber": "+1 390 103 6917",
"mobile": "+1 680 734 6300",
"sn": "mgarza",
"cn": "mgarza",
"userPassword": "{SSHA512}password",
"description": "This is the description for Marcia Garza.",
"street": "70110 Fourth Street",
"st": "OH",
"postalAddress": "Aaren Atp$70110 Fourth Street$New Haven, OH 93694",
"l": "New Haven",
"postalCode": "93694",
"uid": "user.1",
"objectClass": [
"top",
"inetorgperson",
"organizationalperson",
"person"
]
}
}
]
}