REST Email Marketing API DocumentationOfflineEvents — RecipientsAdds recipients to an offline event. HTTP VERBPost URL/API/Rest/OfflineEvents/Recipients/Add ARGUMENTS
Required permissionPopulateOfflineEvent ERRORS
No Permission RETURNS"Success", or an array of messages, one entry for ever error encountered.
["Email address abe@example.com was not found in the database.",
EXAMPLEAdds 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