REST Email Marketing API DocumentationMAILINGS — PREVIEWReturn the contents of the mailing after applying mail merging for a specific recipient. HTTP VERBGet URL/API/Rest/Mailings/Preview ARGUMENTS
mailingTitle Required permissionViewMailing or EditMailing ERRORS
In addition to the following specific messages, you may get a message specific to the type of failure during mail merging. RETURNSDetails for the mailing.
{"textBody":"This is the text portion","htmlBody":"This is the \u003cb\u003eHTML\u003c/b\u003e","headers":{"From":"\"Example sales\"\u003csales@example.com\u003e",
"To":"\"Joe Jones\" \u003cjoe@example.com\u003e","Reply-To":"\"example sales\"\u003cjoe@example.com\u003e","Date":"Thu, 21 Feb 2019 16:45:20 -0800",
"Message-ID":"\u003c0$13794002517401084410$da049470$82931d05@example.com\u003e","Subject":"This is the subject","RcptTo":"fred@example.com",
"List-Unsubscribe":"\u003chttp://example.com/ListUnsub.aspx?MQ=0\u0026V=hiXcXvYIEEcNrNzEA\u003e,\u003cmailto:ListUnsubscribe-0-321@example.com\u003e"},
"recipientId":1,"emailAddress":"sam@aol.com","mailingId":1193}
EXAMPLEGenerate a preview of a mailing for a specific recipient. |
string url = "http://example.com/api/rest/Mailings/Preview?accountName=acme&login=ApiUser&mailingTitle=Test1&emailAddress=joe@example.com"; try { System.Net.HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url); request.Headers.Add("Password", "34teh6i6j565ydw4h"); using (System.Net.WebResponse response = request.GetResponse()) using (Stream responseStream = response.GetResponseStream()) using (StreamReader reader = new StreamReader(responseStream, Encoding.UTF8)) System.Console.WriteLine(reader.ReadToEnd()); } catch (System.Net.WebException ex) { System.Diagnostics.Debug.Fail(ex.Message); }
# encoding: utf-8 require 'rest-client' require 'json' url = 'http://example.com/api/rest/Mailings/Preview/?accountName=acme&login=ApiUser&mailingTitle=Test1&emailAddress=joe@example.com' response = RestClient.get(url, "", {:Password => "sfhdf6df5fdy"}) puts response
import requests url = "http://www.example.com/api/rest/Mailings/Preview/?accountName=acme&login=ApiUser&mailingTitle=Test1&emailAddress=joe@example.com"; headers = {'password':'sfhdf6df5fdy'} resp = requests.get(url, headers=headers) if resp.status_code == 200: print resp.text
http://example.com/api/rest/Mailings/Preview/?accountName=acme&login=ApiUser&password=sdff34fg34s&mailingTitle=Test1&emailAddress=joe@example.com