Configuration objects
IDM provides an extensible configuration to allow you to leverage regular configuration mechanisms.
Unlike native the IDM configuration, which is interpreted automatically and can start new services, IDM stores custom configuration objects and makes them available to your code through the API.
For an introduction to the standard configuration objects, see Server configuration.
When To use custom configuration objects
Configuration objects are ideal for metadata and settings that need not be included in the data to reconcile. Use configuration objects for data that does not require audit logs, and does not serve directly as a target or source for mappings.
Although you can set and manipulate configuration objects programmatically and manually, configuration objects are expected to change slowly, through both manual file updates and programmatic updates. To store temporary values that can change frequently and that you do not expect to be updated by configuration file changes, custom repository objects might be more appropriate.
Custom configuration object naming conventions
By convention custom configuration objects are added under the reserved context, config/custom
.
You can choose any name under config/context
. Be sure, however, to choose a value for context that does not clash with future IDM configuration names.
Mapping configuration objects To configuration files
If you have not disabled the file-based view for configuration, you can view and edit all configuration including custom configuration in openidm/conf/*.json
files. The configuration maps to a file named context-config-name.json
, where context for custom configuration objects is custom
by convention, and config-name is the configuration object name. A configuration object named escalation
thus maps to a file named conf/custom-escalation.json
.
IDM detects and automatically picks up changes to the file.
IDM also applies changes made through APIs to the file.
By default, IDM stores configuration objects in the repository. The file view is an added convenience aimed to help you in the development phase of your project.
Configuration objects file and REST payload formats
By default, IDM maps configuration objects to JSON representations.
IDM represents objects internally in plain, native types like maps, lists, strings, numbers, booleans, null. The object model is restricted to simple types so that mapping objects to external representations is easy.
The following example shows a representation of a configuration object with a look-up map.
{
"CODE123" : "ALERT",
"CODE889" : "IGNORE"
}
In the JSON representation, maps are represented with braces ({ }
), and lists are represented with brackets ([ ]
). Objects can be arbitrarily complex, as in the following example.
{
"CODE123" : {
"email" : ["sample@sample.com", "john.doe@somedomain.com"],
"sms" : ["555666777"]
}
"CODE889" : "IGNORE"
}
Accessing configuration objects through the REST API
You can list all available configuration objects, including system and custom configurations, using an HTTP GET on /openidm/config
.
The _id
property in the configuration object provides the link to the configuration details with an HTTP GET on /openidm/config/id-value
. By convention, the id-value for a custom configuration object called escalation
is custom/escalation
.
IDM supports REST mappings for create, read, update, delete, patch, and query of configuration objects.
Accessing configuration objects programmatically
You can address configuration objects as resources using the URL or URI config/
prefix both internally and also through the REST interface. The resource API provides script object functions for create, read, update, query, and delete operations.
IDM supports concurrency through a multi version concurrency control mechanism. Each time an object changes, IDM assigns it a new revision.
Objects can be arbitrarily complex as long as they use supported types, such as maps, lists, numbers, strings, and booleans.
Creating objects
The following script example creates an object type.
openidm.create("config/custom", "myconfig", mymap)
Updating objects
The following script example updates a custom configuration object type.
openidm.update("config/custom/myconfig", mymap)