The Create Template command allows you to define and create a new template of content to send to Contacts. The command allows you to specify several components of a template, such as Subject and Body. Use POST to send large blocks of template body data. More advanced control of the Template properties must be set through the web interface or WebServices API where available.
Arguments
Create Template requires the following arguments: Command, Realm, Password, and Template Name.
api_web?r=myrealm&p=mypass&c=createtemplate&template_name=My+Template&template_subject=My%20Subject
The command is ‘createtemplate’, the realm is ‘myrealm’ and the password is ‘mypass’. The new, empty template will be named ‘My Template’ with the subject line 'My Subject'.
The Create Template command supports the following arguments:
Name |
Req? |
Description |
Argument |
Command |
Yes |
Defines the command to use. |
cmd=createtemplate c=createtemplate |
Realm |
Yes |
Name of the realm to run the command. This is required, and the command will fail if the realm and password do not match. |
realm=[realm_name] r=[realm_name] |
Password |
Yes |
Authentication code for API access. This is required, and the command will fail if the realm and password do not match. |
pwd=[password] p=[password] |
Template Name |
Yes |
Name of the template to create. To include spaces, use + or %20 to avoid possible issues with spaces in a URL. |
template_name= [template_name] |
Subject |
Yes |
Subject Line of the message to send. This field has a limit of 48 characters. |
template_subject=[text] |
Plain Body |
|
Plain-Text content to send. |
template_body_plain=[text] |
HTML Body |
|
HTML content to send. |
template_body_html=[text] |
Mobile Body | Mobile content to show when Display Mobile link clicked. | template_body_mobile=[text] | |
Character Set |
|
If the content of the template included Unicode characters, set the Charset to utf-8. |
charset=[utf-8] DEFAULT==none |
Character Encoding |
|
When the message is sent, the characters will be encoded either in Base-64 format or Quoted-Printable, depending on the option selected. |
encoding= [default,base64, quoted] DEFAULT==default |
Folder | Identifier of the Folder to associate the Creative for organization. Default folder is 0, or Unfiled. | folder_id=[folder_id] |
Example
Using all commands and arguments (please note the command is wrapped for display purposes only):
api_web?r=myrealm&p=mypass&c=createtemplate&template_name=mytemplate&template_subject=My%20Subject%20Line&template_body_plain=this%20is%20a%20Plain%20test&template_body_html=this%20is%20an%20HTML%20test&folder_id=3
Successful results return, where ‘42’ is the ID of the new template:
SUCCESS: 42
This is a very simple example. You can also POST the values, which allows you to send much larger template body data.
Results
The Create Template command outputs either a SUCCESS or FAILURE message.
SUCCESS
The Create Template command success message returns the id of the new template. The result format is:
SUCCESS: [template_id]
FAILURE
A Create Template command will fail if a template with the same name already exists or invalid data is defined. The result format is:
FAILURE: [Reason]