REST Email Marketing API Documentation

OfflineEvents — Recipients

Adds recipients to an offline event.

HTTP VERB

Post

URL

/API/Rest/OfflineEvents/Recipients/Add

ARGUMENTS

offlineEvent Name of the offline event
columns An array of column names that match with the defined column names for this offline event.
data An array of arrays of data. Each row should have an entry for each of the columns defined above.

Required permission

PopulateOfflineEvent

ERRORS

No Permission
Invalid offline event
Must provide some columns
Must provide some data
One not-null column was not provided in the input file, so the file cannot be loaded. The missing column is:
Several not-null columns were not provided in the input file, so the file cannot be loaded. The missing columns are:
Row has too few columns
Column doesn't exist in the offline event table.
For row with email address , column is null but the field is configured to require a value.
For the row with email address , column '' with value '' is too long for the database field. This entire row will be not be imported.
Invalid column type for column
For row with recipient identifier , unable to parse value '' for column ''. This will prevent this row from being imported.
Email address was not found in the database.
Skipping entry that already exists in the table for recipient
A database issue prevented the import of the row with email address
An unknown issue prevented the import of the row with email address
Too many API calls
Database error
Unknown error

RETURNS

"Success", or an array of messages, one entry for ever error encountered.


["Email address abe@example.com was not found in the database.",
"Email address rob@aol.com was not found in the database."]


EXAMPLE

Adds recipients to an offline event.

string message = "{'accountName':'acme','login':'ApiUser', 'password':'sdve4t3gfd', 'offlineEvent':'Shopping cart abandonment', 'columns':['EmailAddress', 'SKU', 'Price', 'Quantity', 'Product Link'], 'data':[['joe@aol.com', 'abc123', '$55.00', '2', 'http://www.dgsdfgsd.com'], ['rob@aol.com', 'ddd111', '$123.12',' 3','http://www.www.com']]}";
string url = "http://example.com/api/rest/OfflineEvents/Recipients/Add";

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/OfflineEvents/Recipients/Add'
args = {'accountName'=>'acme', 'login'=>'ApiUser', 'password'=>'sdf3w4tw', 'offlineEvent'=>'Shopping cart abandonment', 'columns'=>['EmailAddress','SKU','Price','Quantity','Product Link'], 'data'=>[['joe@aol.com','abc123','$55.00','2','http://www.dgsdfgsd.com'], ['rob@aol.com','ddd111','$123.12','3','http://www.www.com']]}
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/OfflineEvents/Recipients/Add";
args = {'accountName':'acme','login':'ApiUser', 'password':'sdgf3t3f3f', 'offlineEvent':'Shopping cart abandonment', 'columns':['EmailAddress','SKU','Price','Quantity','Product Link'], 'data':[['joe@aol.com','abc123','$55.00','2','http://www.dgsdfgsd.com'], ['rob@aol.com','ddd111','$123.12','3','http://www.www.com']]}
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':'sdgf3t3f3f', 'offlineEvent':'Shopping cart abandonment', 'columns':['EmailAddress','SKU','Price','Quantity','Product Link'], 'data':[['joe@aol.com','abc123','$55.00','2','http://www.dgsdfgsd.com'], ['rob@aol.com','ddd111','$123.12','3','http://www.www.com']]}" http://example.com/API/Rest/OfflineEvents/Recipients/Add

Share this: