Overview
The includes collection contains information about message content includes stored in the HTML content library. HTML content can be used for repeated message elements such as headers and footers or to store large experiment code and advanced Smarty functions.
- API set name: includes
Additional information
- Message content includes are referenced and displayed in a message using Smarty.
- Message content includes are compiled and rendered in a message at send time or in message preview.
- Content keys must be unique and cannot contain spaces or special characters.
- The use of proper HTML markup is highly recommended to avoid message rendering issues. Using HTML block elements within inline elements could distort rendered content.
- Depending on your REST API client, you may be required to define the
content-type
header as application/json. This is not necessary when using the Swagger platform.
GET/includes
Method | URI Path |
---|---|
GET | /includes |
|
-
The following URI will retrieve all message content includes stored in the HTML content library.
http://<path>/includes
The following URI will retrieve
createdAt
andname
fields of all message content includes stored in the HTML content library.http://<path>/includes?fields=createdAt,name
GET/includes/{key}
Method | URI Path |
---|---|
GET | /includes/{key} |
|
-
The following URI will retrieve the message content include with the key of "header".
http://<path>/includes/header
POST/includes
Method | URI Path |
---|---|
post | /includes |
|
-
*Required
Parameter Type Description Example *key string Unique message content key to identify and reference the include. footer name string Message content include name. Message footer description string A short description for the message content include. Default message footer *content string HTML or Smarty content to be used as an include in message content. <h2>Hello, world!</h2> -
The following will create a simple message content include footer within the HTML Content library.
{ "key": "footer", "name": "Message Footer", "description": "Default message footer", "content": "<table><tr><td>© 2020 Example Company</td></tr></table>" }
-
The following URI in conjunction with the JSON will perform the POST.
http://<path>/includes
PUT/includes/{key}
Method | URI Path |
---|---|
PUT | /includes/{key} |
Updates message content include name , description , and content fields. |
-
The following will update the
name
,description
, andcontent
fields of an existing message content include with the key name of "footer". Note that message content includekey
can not be updated once set.{ "name": "Copyright message footer", "description": "Default copyright message footer", "content": "<table><tr><td>© 2021 Example Company</td></tr></table>" }
-
The following URI in conjunction with the JSON will perform the PUT.
http://<path>/includes/footer
DELETE/includes/{key}
Method | URI Path |
---|---|
DELETE | /includes/{key} |
|
-
The following URI will delete the message content include with the key value is
footer
.http://<path>/includes/footer
Error responses
The Cordial API will return an error object with an errorKey
and message
if there is a problem with an API call. Below is a list of errors specific to the Message Content Includes API endpoint, along with suggested modifications to resolve each error. If you receive an error from this API endpoint that is not listed in this table, it is likely recorded within the Global API Error Responses page.
errorKey | Message | Modifications |
---|---|---|
INCLUDES_REMOVE_IMPOSSIBLE | Include can't be deleted because it used in next message automation(s) - :automation | The content include you are attempting to remove is being actively used. |
INCLUDES_REMOVE_IMPOSSIBLE_BATCHES | Include can't be deleted because it used in next message(s) - :batches | The content include you are attempting to remove is being actively used. |
INCLUDES_KEY_UNIQUE | Key must be unique | The content include key must be unique. |
CONTENT_VALIDATION_CHARSET | Incorrect charset in message On Line :line, update charset to: charset=UTF-8 | Content include contains invalid character encoding. Please set to UTF-8. |
CONTENT_VALIDATION_CHARSET_1 | Incorrect charset in message Update charset to: charset=UTF-8 | Content include contains invalid character encoding. Please set to UTF-8. |
CONTENT_VALIDATION_JS | Content may not contain js | Content include may not contain JavaScript. |
CONTENT_VALIDATION_BLOCKS | Block tag detected in content. Please use the Sculpt Editor. | The Sculpt Editor will provide a live preview for testing. |
Comments
0 comments
Please sign in to leave a comment.