REST Email Marketing API Documentation

DOCUMENTS — RETRIEVE

Get data about matching documents.

HTTP VERB

Post

URL

/API/Rest/Documents/Retrieve

ARGUMENTS

documents (Optional) An array of document names to retrieve
topic (Optional) The topic used for unsubscribes for the document.
sentStart (Optional) Search for documents sent after this date.
sentEnd (Optional) Search for documents sent before this date.

All arguments are optional. If none are provided, the 1000 documents are retrieved. Search criteria is combined with AND, so providing document names and search dates will get you just those documents sent within that time period.

Required permission

ViewDocument

ERRORS

No Permission
Invalid document name
Invalid topic name
Database error
Unknown error

RETURNS

A structure with the key document data:

  • Document ID
  • Document Name
  • Subject
  • Topic name

{"downloadGuid":"7c6febff-f83f-469e-bd23-2ebe755a4563","totalRows":2,"userData":[["2879","Survey 1","We'd like your feedback","JHY Surveys"],["2864","Survey 2","Please provide feedback","JHY Surveys"]]}

EXAMPLE

Get the data for a document.

string message = "{'accountName':'acme','login':'ApiUser', 'password':'sdve4t3gfd', 'documents':['Survey 1', 'Survey 2'], 'sentStart':'2016-08-15 00:00:00Z'}";
string url = "http://example.com/api/rest/Documents/Retrieve";

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/Retrieve'
args = {'accountName'=>'acme', 'login'=>'ApiUser', 'password'=>'sdf3w4tw', 'documents'=>['Invite','Invite1'], 'sentStart'=>'2016-01-01','sentEnd'=>'2016-02-28' }
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/Retrieve";
args = {'login':'ApiUser','password':'sdfgeeerg','accountName':'acme','documents':['Survey 1','Survey 2'],'sentStart':'2016-08-15 00:00:00Z'}
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 "{'login':'ApiUser','password':'sdfgeeerg','accountName':'acme','documents':['Survey 1','Survey 2'], 'sentStart':'2016-08-15 00:00:00Z'}" http://localhost:2002/api/rest/Documents/Retrieve

Share this: