Reference Data Client API
The Reference Data Client API accesses the Reference Data Service over HTTPS. It is represented by the ReferenceDataHttpClient class, and implements the IReferenceDataClient interface.
Synchronous and asynchronous versions of each method are available. For example, EnsureDefinitionType() and EnsureDefinitionTypeAsync().
All examples use a basic Definition<string,string> defintion type, but you can also create custom types.
Get the Reference Data Client API in a Sitecore context
Get the Reference Data Client API in a Sitecore context
The following example demonstrates how to retrieve a read-only and a read/write instance of the Reference Data Client API in a Sitecore context:
In a Sitecore context, configuration controls whether the service implementation or the HTTP client implementation is returned.
Get the Reference Data Client API in a non-Sitecore context
Get the Reference Data Client API in a non-Sitecore context
The following example demonstrates how to construct the ReferenceDataHttpClient in a non-Sitecore context:
Retrieve a definition
Retrieve a definition
The following example demonstrates how to retrieve a definition. If you do not specify a culture, all available cultures are returned.
Retrieve a culture-specific definition
The following example demonstrates how to retrieve a culture-specific definition:
Retrieve culture-invariant definition
The following example demonstrates how to retrieve a culture invariant definition:
Culture invariant data is used when data has a culture, but that culture is not explicitly defined by the source of the data. For example, an external provider might provide a list of city names in English, but does not explicitly specify the culture of the data. In such cases, data should be stored as culture invariant.
Save a Definition
Save a Definition
The following example demonstrates how to create and save a new definition in various cultures:
Save Multiple Definitions
Save Multiple Definitions
The following example demonstrates how to save multiple definitions:
Activate a Definition
Activate a Definition
To activate a definition, set the IsActive property of the definition to true and save the definition.
Get all definitions by a specific type
Get all definitions by a specific type
The following example demonstrates how to get all definitions by a specific type and paginate the results.