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.

using System;
using System.Net.Http;
using System.Text;

string url = "https://example.com/API/Rest/Documents/Retrieve";
string message = "{\"accountName\":\"acme\",\"login\":\"ApiUser\",\"password\":\"YOUR_PASSWORD\",\"documents\":[\"Survey 1\",\"Survey 2\"],\"sentStart\":\"2016-08-15 00:00:00Z\"}";

// Reuse HttpClient for multiple requests in production code.
using (var client = new HttpClient())
using (var request = new HttpRequestMessage(HttpMethod.Post, url))
{
	request.Content = new StringContent(message, Encoding.UTF8, "application/json");

	using (HttpResponseMessage response = await client.SendAsync(request))
	{
		response.EnsureSuccessStatusCode();
		Console.WriteLine(await response.Content.ReadAsStringAsync());
	}
}
			
# encoding: utf-8
require 'rest-client'
require 'json'
							
url = 'https://example.com/API/Rest/Documents/Retrieve'
args = {'accountName'=>'acme', 'login'=>'ApiUser', 'password'=>'YOUR_PASSWORD', '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 = "https://example.com/API/Rest/Documents/Retrieve"
args = {'login':'ApiUser','password':'YOUR_PASSWORD','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 --request POST --header "Content-Type: application/json" --data '{"accountName":"acme","login":"ApiUser", "password":"YOUR_PASSWORD", "documents":["Survey 1", "Survey 2"], "sentStart":"2016-08-15 00:00:00Z"}' "https://example.com/API/Rest/Documents/Retrieve"