REST Email Marketing API Documentation

UTILITY — GETFILE

Retrieve the entire contents of a large data export. When an API call results in too much data to return in a single call, the call provides a GUID that can be referenced to download the entire results. Simply call this function, providing the GUID, and the data will be returned as an attachment. Note that the file contents will be in CSV format instead of JSON.

HTTP VERB

Get

URL

/API/Rest/Utility/GetFile

ARGUMENTS

fileNameGuid

Required permission

(none)

ERRORS

Invalid file name
Database error
Unknown error

RETURNS

A data stream of the contents of the API call.



EXAMPLE

Get the large results from a previous API call.

string url = "http://www.example.com/API/Rest/Utility/?AccountName=acme&login=ApiUser&fileNameGuid=4bd7fcc4-f295-475a-9761-1c1de981841d";
System.Net.HttpWebRequest req = (System.Net.HttpWebRequest)System.Net.WebRequest.Create(url);
System.Net.HttpWebResponse resp = (System.Net.HttpWebResponse)req.GetResponse();
req.Headers.Add("Password", "cxv6sfdh23r78hd");
							
string results;
							
using (StreamReader sr = new StreamReader(resp.GetResponseStream()))
	results = sr.ReadToEnd();
							
require "open-uri"
							
open("http://www.example.com/API/Rest/Utility/GetFile/?AccountName=acme&login=ApiUser&fileNameGuid=b831e9b7-c09b-46f7-a214-81e89489d0b3&password=cd7dh3e7fh") do |data|
	File.open("Sample.txt", "wb") do |file|
		file.write(data.read)
	end
end
							
import requests

url = "http://www.example.com/api/rest/Utility/GetFile/?accountName=acme&login=ApiUSer&fileNameGuid=e17e3916-08d2-4ea3-a345-eb7307638fb7";
headers = {'Password':'dvs673gdfsyusd'}
resp = requests.get(url, headers=headers)
if resp.status_code == 200:
	with open('c:/temp/PythonDownload.txt', 'wb') as f:  
		f.write(resp.content)
						

http://www.example.com/API/Rest/Utility/GetFile/?AccountName=acme&login=ApiUser&fileNameGuid=4bd7fcc4-f295-475a-9761-1c1de981841d&password=7yf65egdf73eg

Share this: