IDM 7.3.1

Default REST context

By default, IDM objects are accessible over REST at the context path /openidm/*, where * indicates the remainder of the context path; for example, /openidm/managed/user. You can change the default REST context (/openidm) by setting the openidm.servlet.alias property in your project’s resolver/boot.properties file.

The following change to the boot.properties file sets the REST context to /example:

openidm.servlet.alias=/example

After this change, objects are accessible at the /example context path, for example:

curl \
--header "X-OpenIDM-Username: openidm-admin" \
--header "X-OpenIDM-Password: openidm-admin" \
--header "Accept-API-Version: resource=1.0" \
--request GET \
"http://localhost:8080/example/managed/user?_queryFilter=true&_fields=_id"
{
  "result": [
    {
      "_id": "bjensen",
      "_rev": "0000000042b1dcd2"
    },
    {
      "_id": "scarter",
      "_rev": "000000009b54de8a"
    }
  ],
  ...
}

To use the admin UI, you must also change the following files, so that the UI is accessible at the new context path:

  • In the /path/to/openidm/ui/admin/default/index.html file, change the context. For example, if your new REST context is example, adjust that file as follows:

    ...
    <script>
        const context = "/example";
    ...
    </script>
    ...
  • In the /path/to/openidm/ui/admin/default/org/forgerock/openidm/ui/common/util/Constants.js file, change the value of the commonConstants.context property. For example:

    commonConstants.context = window.context || "/example";

Note that changing the REST context impacts the API Explorer. To use the API Explorer with the new REST context, change the baseUrl property in the /path/to/openidm/ui/api/default/index.html file.

Based on the change to the REST context earlier in this section, you’d set the following:

//base URL for accessing the OpenAPI JSON endpoint
var baseURL = '/example/';