Settings client

The SDK provides a Settings client to provide some extra utilities for retrieving settings.

Settings are entities that can be used with the Querying client and the Entities client. This client can be useful for replacing some queries that would otherwise have to be manually written.

Note

The client variable in the following code examples refers to the ContentHubClient instance. When using the JavaScript SDK, the variable name can be chosen freely, but is also called client at instantiation in the documentation.

Getting the category ID

For example, the following snippet gets the ID of the PortalConfiguration category:

RequestResponse

var id: number = await client.settings.getCategoryIdAsync("PortalConfiguration");

Getting a setting

For example, in the PortalConfiguration category, there is a setting named Authentication that can be retrieved using the following method:

RequestResponse

var setting: IEntity = await client.settings.getSettingAsync("PortalConfiguration", "Authentication");

It is possible to pass an entity load configuration to the client.

Getting all the settings for a category

Getting all the settings for a category is also possible. For example, the following snippet gets all the rendition settings:

RequestResponse

var renditionSettings : IEntity[] = await client.settings.getSettingsForCategoryAsync("Renditions");

It is possible to pass an entity load configuration.

Do you have some feedback for us?

If you have suggestions for improving this article,