Update a template
PUT /v3/templates/<templateRef>
Updates a template. Every update increases the value in the revision key by one.
| Attribute | Type | Description | Example |
|---|---|---|---|
templateRef | string | The reference of the template. If you do not know the template reference, first retrieve templates. | 340ced1b-c9b7-43f0-9eec-2b9f0b7693fa |
At a minimum, you must provide the following required attributes in the request body:
| Attribute | Type | Description | Example(s) |
|---|---|---|---|
name | string | The name of the template. | "Alert bar template" |
friendlyId | string | The unique ID of the template. Only lowercase alphanumeric characters and underscores are allowed. | "alert_bar_template_1" |
type | string enum (uppercase) | The type of the template. | Must be one of:
|
status | string enum (uppercase) | The current status of the template. | Must be one of:
|
description | string | The description of the connection. | "Alert bar web template" |
render | boolean | Determines whether to render a preview of the web template in the Sitecore Personalize app. Only set this to true if you're confident that your web template can render.Do not set this to true for more sophisticated web templates that use handlebars loops. | true, false |
defaultTemplate | boolean | Determines whether this is a default template. When you create a template, you must set this value to false. | false |
customTemplate | boolean | Determines whether this is a custom template. When you create a template, you must set this value to true. | true |
templateElementsoptional | JSON array of JSON objects | Custom HTML, CSS, JavaScript, and FreeMarker codes that define the template. | "mys3cr3tstr1ingforauth1!x" |
The optional templateElements array of objects lets you include HTML, CSS, JavaScript, and FreeMarker codes in your templates. For the objects in templateElements, use the following attributes:
| Attribute | Type | Description | Example(s) |
|---|---|---|---|
id | string enum (lowercase) | The type of code that you include in the template attribute.For example, to include CSS code in the template, set this value to "css", then specify the custom CSS code in the template attribute. | Must be one of:
|
template | string | Stringified HTML, CSS, JavaScript, or FreeMarker code. For FreeMarker code, you must at a minimum include an opening and a closing curly bracket {}. |
|
Here's an example of the templateElements array of objects:
If you have suggestions for improving this article, let us know!