The appearance request object
You can add an appearance JSON object in a Sitecore Discover Search and Recommendation request. The object contains the HTML, CSS, and JavaScript templates and variables associated with a widget on a page. Use the appearance object to get appearance information that the widget needs to render the display. You must define at least one of the templates or variables in your request.
The following shows the structure of the appearance object in a request:
{
"appearance": {
"<templates>": {
"section": ["string"],
"devices": ["string"],
"keep_original_css": false,
"keep_variables": false
},
"<variables>": {
"section": ["string"]
},
}
}Keys
The following table describes the keys that the appearance object contains.
|
Key |
Type |
Description |
Value |
|---|---|---|---|
|
|
Optional. Gets templates for the widget. By default, the response returns all sections for a specific device explicitly indicated in the request context or in the | ||
|
|
Optional. Gets variables defined in the widget's appearance style. By default, Discover returns all variables. Note During runtime, you do not usually require | ||
|
|
Optional. Request for includes (or file paths). By default, Discover returns all sections for the device explicitly indicated in the request browser context or in the request header. |
Templates object
The following table describes the keys in the templates object:
|
Key |
Type |
Description |
Value |
|---|---|---|---|
|
|
Array of strings |
Optional. Gets templates for the widget. By default, the response returns all sections for a specific device explicitly indicated in the request context or in the |
|
|
|
Array of strings |
Optional. Gets all or specific template sections for the device. |
|
|
|
Boolean |
Optional. If By default, Discover adds the appropriate CSS class names. This ensures that only the widget gets the appearance style and not other parts of the page. Default: |
n/a |
|
|
Boolean |
Optional. If By default, Discover substitutes all variables. Discover only returns as-is:
Default: |
n/a |
Variables object
The following table describes the key in the variables object:
|
Key |
Type |
Description |
Value |
|---|---|---|---|
|
|
Array of strings |
Optional. Gets all or specific variables that are marked for use in the appropriate sections for the requested widget. |
|
Includes object
The following table describes the keys in the includes object:
|
Key |
Type |
Description |
Value |
|---|---|---|---|
|
|
Array of strings |
Optional. Request for all or specific sections of includes for the requested widget. |
|
|
|
Array of strings |
Optional. Request for all or specific sections of includes that apply to the device. |
|
Examples
The following example shows how to get HTML templates for the default device:
{
"appearance": {
"templates": {
"section": ["html"]
}
}
}The following example shows how to retrieve all templates and variable information for all devices:
{
"appearance": {
"templates": {
"devices": []
},
"variables": {ol
"devices": []
}
}
}