REST Email Marketing API Documentation

DOCUMENTS — EDIT

Edit a document. Only the fields that have data are updated. To overwrite an existing field and replace it with no data, or to rename the document, use the web interface.

HTTP VERB

Post

URL

/API/Rest/Documents/Edit

ARGUMENTS

documentName The name of the document to edit.
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 (Optional) 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 (Optional) 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?

Required permission

EditDocument

ERRORS

No Permission
DocumentName cannot be missing
DocumentName is too long. Please limit to 25 characters or less
Document not found to edit.
Invalid UnsubscribeTopic
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

Success

EXAMPLE

Modify a document.

string message = "{'accountName':'acme','login':'ApiUser', 'password':'sdgf34t3sd', 'documentName':'JunkMe2', 'documentText':'I have modified the document text'}";
string url = "http://example.com/api/rest/Documents/Edit";

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/Edit'
args = {'accountName'=>'acme', 'login'=>'ApiUser', 'password'=>'sdf3w4tw', 'documentName'=>'JunkMe2','documentText'=>'I have modified the document text'}
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/Edit";
args = {'accountName':'acme','login':'ApiUser','password':'sdgf34t3sd','documentName':'JunkMe2','documentText':'I have modified the document text'}
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':'I have modified the document text'}" http://www.example.com/api/rest/Documents/Edit

Share this: