---
title: "The appearance request object"
slug: "the-appearance-request-object"
abstract: "Describes the structure and properties of the appearance object in a Discover Search and Recommendation request."
---
# 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:

```csharp
{
    "appearance": {
	"<templates>": {
		"section": ["string"],
		"devices": ["string"],
		"keep_original_css": false,
		"keep_variables": false
	},
	"<variables>": {
		"section": ["string"]
	},
    }
}
```

<details>
<summary><h2>Keys</h2></summary>

The following table describes the keys that the `appearance` object contains.

| Key | Type | Description | Value |
| --- | --- | --- | --- |
| templates | Template object | 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 user_agent header. |  |
| variables | Variables object | Optional.Gets variables defined in the widget's appearance style. By default, Discover returns all variables.NoteDuring runtime, you do not usually require variables because Discover automatically substitutes variable values when it returns the templates. |  |
| includes | Includes object | 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 |
| --- | --- | --- | --- |
| sections | 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 user_agent header.Array of strings | [ ] or empty array - returns all sections.html - returns HTML sections.css - returns CSS sections.s - returns JavaScript sections |
| devices | Array of strings | Optional.Gets all or specific template sections for the device. | [ ] or empty array - returns sections for all devices.pc - returns sections for a desktop or PC.(Default).mobile - returns sections for a mobile device.tablet - returns sections for a tablet device. |
| keep_original_css | Boolean | Optional.If true, Discover retains all CSS section data specified during style definition. For example, Discover response does not add widget div-specific selectors to the CSS.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: false. | n/a |
| keep_variables | Boolean | Optional.If true, Discover does not substitute the variables embedded in the templates with their runtime values.By default, Discover substitutes all variables. Discover only returns as-is:variables that refer to the widget's results.variables that might be substituted by the service based on the results.Default: false. | n/a |

### Variables object

The following table describes the key in the `variables` object:

| Key | Type | Description | Value |
| --- | --- | --- | --- |
| sections | Array of strings | Optional.Gets all or specific variables that are marked for use in the appropriate sections for the requested widget. | [ ] empty array or all - returns variables applicable to any section.html - returns variables applicable to HTML sections.css - returns variables applicable to CSS sections.js - returns variables applicable to JavaScript sections. |

### Includes object

The following table describes the keys in the `includes` object:

| Key | Type | Description | Value |
| --- | --- | --- | --- |
| sections | Array of strings | Optional.Request for all or specific sections of includes for the requested widget. | [ ] empty array or all - returns all sections.html - returns HTML sections.css - returns CSS sections.js - returns JavaScript section. |
| devices | Array of strings | Optional.Request for all or specific sections of includes that apply to the device. | [ ] - empty array or all - returns sections for all devicespc - returns sections for a desktop or PC devicemobile - returns sections for a mobile devicetablet - returns sections for a tablet device |

</details>

<details>
<summary><h2>Examples</h2></summary>

The following example shows how to get HTML templates for the default device:

```csharp
{
    "appearance": {
	"templates": {
	"section": ["html"]
	}
    }
}
```

The following example shows how to retrieve all templates and variable information for all devices:

```csharp
{
    "appearance": {
	"templates": {
	"devices": []
	},
    "variables": {ol
	"devices": []
        }
    }
}
```

</details>