DOCUMENTS — CREATE
Create a document. Documents are used for content that should be sent to a specific recipient based on some event. Some example might include an initial welcome message when subscribing, an order or shipping confirmation, or any documents sent by a workflow process.
HTTP VERB
Post
URL
/API/Rest/Documents/Create
ARGUMENTS
documentName
|
The name of the document to create. Name is limited to 25 characters.
|
documentText
|
(Optional) The text portion of the content.
|
documentHtml
|
(Optional) The HTML portion of the content.
|
charsetId
|
(Optional) The character set ID or name for the content. Ex: 65001
|
delimiterStart
|
(Optional) The delimiter to use to mark the start of a mail merge section. Default is [-, or {{ or [[
|
delimiterEnd
|
(Optional) The delimiter to use to mark the end of a mail merge section. Default is -], or }} or ]]
|
headerFrom
|
(Optional) The header section "from" address. format like: "some name"<someone@example.com>
|
headerTo
|
(Optional) The "to" address in the header. Should normally be mail merge tag NameEmail
|
Subject
|
The subject line for the email message
|
bodyLanguageId
|
(Optional) The language identifier for the language used in the content. Ex: 1033
|
replyTo
|
(Optional) The email address where replies should be sent. Can include mail merge tags. Ex: "Joe Sales"<joe@example.com>
|
additionalHeaders
|
(Optional) A dictionary of keys and values that should be added to the message headers.
|
priority
|
(Optional) An integer between 1 and 9 of the priority of this document compared with other mail sent from this customer. 1 is highest, 9 is lowest, 5 is default.
|
trackedLinks
|
(Optional) An array of the links in the content that should be tracked. Used only if you don't want every link tracked.
|
trackAllLinks
|
(Optional) Boolean of whether to track all the links found in the content. Overridden by the trackedLinks array.
|
recipientLoggingLevel
|
(Optional) What level of logs to keep? (N)o logs, (E)rrors, or (A)ll, including successess. Default is (E)rrors.
|
unsubscribeTopic
|
The name of the topic to use to record unsubscribes against.
|
detectOpens
|
(Optional) Boolean of whether to track opens for this document. Default is true.
|
virtualIpGroup
|
(Optional) If you have multiple IP addressed configured in the system, which one should be used for sending this document?
|
If the defaults are set properly a document can be created by just providing a few of these fields, such as documentName, documentHtml, subject, and unsubscribeTopic. Symphonie supports features for dynamic content or including attachments, but these must be done using the web interface.
Required permission
CreateDocument
ERRORS
No Permission
DocumentName cannot be missing
DocumentName is too long. Please limit to 25 characters or less
No content provided
Invalid UnsubscribeTopic
Document name currently in use.
Invalid CharsetId
Invalid BodyLanguageId
Invalid DelimiterStart. Recommend [- Alternatively {{ or [[
Invalid DelimiterEnd. Recommend -] Alternatively }} or ]]
Mismatched delimiters. Use [- -], {{ }}, or [[ ]]
Invalid Header From value and no default defined. Must be a valid email address, optionally with a user name
Invalid Header To value and no default defined. Must be a valid email address, optionally with a user name
Invalid Reply To value and no default defined. Must be a valid email address, optionally with a user name
Invalid Header From value. Must be a valid email address, optionally with a user name"
Invalid Header To value. Must be a valid email address, optionally with a user name
Invalid Reply To value. Must be a valid email address, optionally with a user name
The subject cannot be blank
Invalid priority value. 1 is highest, 9 is lowest.
Invalid RecipientLoggingLevel. Allowed values are (A)ll, (E)rrors, or (N)one
Invalid VirtualIpGroup value.
Additional headers cannot be blank for the key or the value
Invalid additional headers key:
The following link to be tracked was not found in the content:
Database error
Unknown error
RETURNS
Document created successfully. ID:3146
EXAMPLE
Create a document.
string message = "{'accountName':'acme','login':'ApiUser', 'password':'sdgf34t3sd', 'documentName':'JunkMe2','documentText':'This is the document text', 'documentHtml':'This is the <b>HTML</b>', 'charsetId':'1252', 'subject':'This is the subject', 'bodyLanguageId':'1033', 'trackAllLinks':true, 'unsubscribeTopic':'Surveys', 'headerTo':'[-NameEmail-]'}";
string url = "http://example.com/api/rest/Confirmations/Send";
try
{
System.Net.HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
request.Method = "POST";
request.ContentType = "application/json";
request.ContentLength = message.Length;
using (Stream webStream = request.GetRequestStream())
using (StreamWriter requestWriter = new StreamWriter(webStream, System.Text.Encoding.ASCII))
requestWriter.Write(message);
System.Net.WebResponse webResponse = request.GetResponse();
using (Stream webStream = webResponse.GetResponseStream())
using (StreamReader responseReader = new StreamReader(webStream))
Console.Out.WriteLine(responseReader.ReadToEnd());
}
catch (Exception e)
{
System.Diagnostics.Debug.Fail(e.Message);
}
# encoding: utf-8
require 'rest-client'
require 'json'
url = 'http://www.acme.com/api/rest/Documents/Create'
args = {'accountName'=>'acme', 'login'=>'ApiUser', 'password'=>'sdf3w4tw', 'documentName'=>'JunkMe2','documentText'=>'This is the document text', 'documentHtml'=>'This is the <b>HTML</b>', 'charsetId'=>'1252', 'subject'=>'This is the subject', 'bodyLanguageId'=>'1033', 'trackAllLinks'=>true, 'unsubscribeTopic'=>'Surveys', 'headerTo'=>'[-NameEmail-]'}
response = RestClient.post(url, args.to_json, :content_type => "application/json;charset=utf-8")
puts response
import requests
url = "http://www.example.com/api/rest/Documents/Create";
args = {'accountName':'acme','login':'ApiUser', 'password':'sdgf34t3sd', 'documentName':'JunkMe2','documentText':'This is the document text', 'documentHtml':'This is the <b>HTML</b>', 'charsetId':'1252', 'subject':'This is the subject', 'bodyLanguageId':'1033', 'trackAllLinks':True, 'unsubscribeTopic':'Surveys', 'headerTo':'[-NameEmail-]'}
headers = {'Content-Type': 'application/json'}
resp = requests.post(url, json=args, headers=headers)
if resp.status_code == 200:
print resp.text
curl -X POST -H "Content-Type: application/json" -d "{'accountName':'acme','login':'ApiUser', 'password':'sdgf34t3sd',
'documentName':'JunkMe2','documentText':'This is the document text', 'documentHtml':'This is the <b>HTML</b>',
'charsetId':'1252', 'subject':'This is the subject', 'bodyLanguageId':'1033', 'trackAllLinks':true, 'unsubscribeTopic':'Surveys',
'headerTo':'[-NameEmail-]'}" http://www.example.com/api/rest/Documents/Create