39 Managing Directory Data Using Data Management REST API

You can use the Oracle Unified Directory Data Management REST API to add, modify, remove, and search data in the directory server and manage users and groups.

39.1 Configuring Data Management REST API

You must configure the OUD environment to use the Oracle Unified Directory Data Management REST API.

Configuring Connection Handlers During the OUD Instance Setup

Run oud-setup utility from the command line with httpPort and httpsPort parameters to configure the Data Management REST API interface while creating the Oracle Unified Directory Server instance.

oud-setup --cli \
--adminConnectorPort 1444 \
--httpAdminConnectorPort 1888 \
--rootUserDN cn=Directory\ Manager \
--rootUserPasswordFile password.file \
--ldapPort 1389 \
--ldapsPort 1636 \
--httpPort 1080 \
--httpsPort 1081 \
--generateSelfSignedCertificate \
--baseDN dc=example,dc=com \
--sampleData 200 \
--serverTuning jvm-default \
--offlineToolsTuning jvm-default \
--no-prompt \
--noPropertiesFile

Configuring Connection Handlers for an Existing OUD Instance

  1. Run the dsconfig command-line utility with create-connection-handler subcommand as follows to create the connection handlers:

    Note:

    If you have already created the HTTP/HTTPS connection handler for the OUD instance, then you can update the existing connection handler using the dsconfig command-line utility with the set-connection-handler-prop subcommand.

    Setting Up HTTP Port:

    dsconfig create-connection-handler \
    --handler-name "HTTP Connection Handler" \
    --type http \
    --set enabled:true \
    --set listen-port:1080 \
    --hostname localhost \
    --port 1444 \
    --portProtocol LDAP \
    --bindDN "cn=Directory Manager" \
    --bindPasswordFile /home/oracle/pwd.txt \
    --no-prompt

    Setting HTTPS Port:

    dsconfig create-connection-handler \
    --handler-name "HTTPS Connection Handler" \
    --type http \
    --set enabled:true \
    --set listen-port:1081 \
    --set use-ssl:true \
    --set trust-manager-provider:JKS \
    --set key-manager-provider:JKS \ 
    --hostname localhost \
    --port 1444 \
    --portProtocol LDAP \
    --bindDN "cn=Directory Manager" \
    --bindPasswordFile /home/oracle/pwd.txt \
    --no-prompt
  2. Configure the REST endpoints as follows:
    1. Enable the REST Server extension.
      dsconfig set-extension-prop \
      --Extension-name 'REST Server' \
      --set enabled:true \ 
      --hostname localhost \
      --port 1444 \
      --portProtocol LDAP \
      --trustAll \
      --bindDN "cn=Directory Manager" \
      --bindPasswordFile /home/oracle/pwd.txt \
      --no-prompt
    2. Enable the directory endpoint.
      dsconfig set-directory-end-point-prop \
      --set enabled:true \ 
      --hostname localhost \
      --port 1444 \
      --portProtocol LDAP \
      --trustAll \
      --bindDN "cn=Directory Manager" \
      --bindPasswordFile /home/oracle/pwd.txt \
      --no-prompt
  3. Restart the OUD instance.

Note:

If the LDAPS connection handler is not configured for the OUD instance, then you must configure cn=JKS,cn=Key Manager Providers,cn=config and cn=JKS,cn=Trust Manager Providers,cn=config before you set the HTTPS connection handler. See Using JKS Key Manager Provider and Using the JKS Trust Manager Provider

39.2 Using Data Management REST API

The Data Management REST API enables you to to view, add, search, modify or delete directory data in Oracle Unified Directory.