CSR Service Guide

May 7, 2013

PUBLIC DISTRIBUTION

DST Systems
Electronic Solutions Division
333 W 11th St
Kansas City, MO 64105
www.dstsystems.com

ePriority Development
www.epriority.com


ePriority Logo
© Copyright 2001-2015 DST Systems. All rights reserved. This file may not be copied in whole or in part in any medium without the express written consent of the owner.



Contents Up


Introduction Up

The CSR Service is used for searching for emails across account or batch. Search criteria can be email address or cpid, which returns a list of emails. A specific email can also be requested by record_id (returned in search results list). The MIME formatted email is returned for a specific email. Requests for resending a specific email or secure email password are also supported. Resent email or passwords can be sent to the original To address or a new, alternative address. The rendered text/plain or html email can be viewed with additional parameters. Errors may occur when bad credentials are supplied or incorrect/incomplete data is given in the CSR query.

If you have not already done so, you should read the «ePriority Service Overview» before going further with this document as it will provide context for all ePriority features.


HTTP Query Up

To request a report through an HTTPS query, the following parameters must be supplied:

version Must be "1"
The Transaction Service version number. Later releases may provide new versions
cid Your ePriority Client ID.
authDate Allowed: T, 0-9, dash, colon
Authentication Date: the date and time the request was created, represented as a string in UTC. The following ISO 8601 format should be used: YYYY-MM-DDThh:mm:ss (eg 1997-07-16T19:20:30)
authHash Allowed: a-f, A-F, 0-9
Length: 32
SHA256 Hexidecimal Authentication String.
action Allowed: list | record | redeliver | password | part
listsize Allowed: integer, default=500
Used with list as search criteria. Limits the numer of email records returned.
record_id Allowed: 0-9, underscore
Used with record, redeliver or password actions. The record_id is returned with each record in the search listing.
addr Must be a valid email address
Used with list as search criteria. Should be URL-Encoded prior to submission.
id Allowed: a-z, A-Z, 0-9, period, hyphen
Length: 1-29
Used with list as search criteria. Email identification. Normally unique for every email in a batch. Cannot begin with a period or a hyphen. Periods and hyphens are not allowed to be adjacent to themselves or each other. In other words, no Id string may contain any of the following sequences: "..", ".-", "-.", or "--".
id2 Allowed: a-z, A-Z, 0-9, period, hyphen
Length: 1-29
Used with list as search criteria. Email identification value 2. Cannot begin with a period or a hyphen. Periods and hyphens are not allowed to be adjacent to themselves or each other. In other words, no Id string may contain any of the following sequences: "..", ".-", "-.", or "--".
id3 Allowed: a-z, A-Z, 0-9, period, hyphen
Length: 1-29
Used with list as search criteria. Email identification value 3. Cannot begin with a period or a hyphen. Periods and hyphens are not allowed to be adjacent to themselves or each other. In other words, no Id string may contain any of the following sequences: "..", ".-", "-.", or "--".
start Allowed: YYYY/MM/DD
Length: 10
Used with list as search criteria. Starting date of search. Can be used in conjunction with 'end' to search a specified date range or alone to search from start date to current date. Should be URL-Encoded prior to submission. Date range must be within a calendar year.
end Allowed: YYYY/MM/DD
Length: 10
Used with list as search criteria. Ending date of search. Can be used in conjunction with 'start' to search a specified date range or alone to search all history up until the stop date specified. Should be URL-Encoded prior to submission. Date range must be within a calendar year.
profile Allowed: a-z, A-Z, 0-9, underscore
Length: 1-35
Used with list as search criteria. Name of the profile used to send email. Cannot begin with an underscore.
address Must be a valid email address
Used with redeliver and password actions as the new To address. If this parameter is not supplied, the original To address will be used. Should be URL-Encoded prior to submission.
num Allowed: 1-9
In conjunction with an action of 'part', the number coincides with the mime part of the rendered email that will be shown. Since emails are required to have at least one body, a num of one is guaranteed. Emails with multiple mimeparts are represented with incremented counts.
isRelayMail Allowed: true | false, default=false
Distinguishes batch or transaction/relay mail. If you are searching for web service transaction emails or SMTP relay emails you must use this parameter. Without the parameter or if the value is false, batch emails will be searched.

Authentication Up

The cid (ePriority Client ID), authDate and authHash parameters are required for authentication of all Web API requests. See authentication instructions.


Using the CSR Service Up


Sample Requests Up

https://www.epriority.com/EmailReports?version=1&cid=12345&authDate=2010-04-19T08:24:39&authHash=3ad64d6780d2c4762b335570646939e0&action=list&profile=Monthly_Statements&start=02/01/2010&stop=02/01/2010
Look for monthly statement emails submitted on Feb 1.

https://www.epriority.com/EmailReports?cid=12345&authDate=1303224086377&authHash=cce48ea23edf7c97fa65bb1f2bd1b341&action=list&id=14KS2g9oiyLuE9JYQC&listsize=10
Search for the last 10 emails to account ID 14KS2g9oiyLuE9JYQC

https://www.epriority.com/EmailReports?cid=12345&authDate=1303225511226&authHash=7f6038f801fb69cd9513a7a7d9a31482&action=list&addr=test.user@gmail.com&isRelayMail=true&listsize=5
Search for the last 5 transaction or relay emails to address test.user@gmail.com.

https://www.epriority.com/EmailReports?cid=12345&authDate=1303224194210&authHash=381a47e16fb5d9f20ec99a556e3cdf68&action=record&record_id=2003009540_1
Get detailed email information for record_id 2003009540_1.

https://www.epriority.com/EmailReports?cid=12345&authDate=1303240706669&authHash=31701e5db9800e11619764aec833cba1&action=redeliver&isRelayMail=true&record_id=2003017997_8
Redeliver transaction or relay email with record_id 2003017997_8.


Outputs Up

HTTP response 403 (forbidden) is returned when authentication fails.
<root>Access Denied</root>

Successful List Request

<?xml version="1.0" encoding="UTF-8"?>
<root>
  <email_record>
    <record_id>2001056312_2</record_id>
    <address>epriority_test@dstoutput.com</address>
    <subject>This is a test message</subject>
    <client_id>1105</client_id>
    <batch_id>2001056312</batch_id>
    <client_batch_id>test1456295456</client_batch_id>
    <email_id>2</email_id>
    <cpid>acctnum45825647</cpid>
    <cpid2 />
    <cpid3 />
    <creation_date>2008-05-22 19:03:38.631000</creation_date>
    <delivered_date>2008-05-22 19:05:59.184318</delivered_date>
    <receipt_date />
    <viewed_date>2008-05-22 19:06:29.184318</viewed_date>
    <replied_date />
    <clicked_date />
    <failed_date />
    <failed_code>0</failed_code>
    <failed_description />
    <profile_name>default</profile_name>
    <pprofileId>1001</pprofileId>
  </email_record>
  <email_record>
    <record_id>2001056310_1</record_id>
    <address>epriority_test@dstoutput.com</address>
    <subject>Welcome to Bank XYZ.</subject>
    <client_id>1105</client_id>
    <batch_id>2001056310</batch_id>
    <client_batch_id>new_cust_conf86458618</client_batch_id>
    <email_id>1</email_id>
    <cpid>acctnum45825647</cpid>
    <cpid2 />
    <cpid3 />
    <creation_date>2008-05-22 18:38:41.745000</creation_date>
    <delivered_date>2008-05-22 18:40:45.421363</delivered_date>
    <receipt_date />
    <viewed_date>2008-05-22 18:49:45.421363</viewed_date>
    <replied_date />
    <clicked_date />
    <failed_date />
    <failed_code>0</failed_code>
    <failed_description />
    <profile_name>default</profile_name>
    <pprofileId>1001</pprofileId>
  </email_record>
</root>

Successful Record Request

<?xml version="1.0" encoding="UTF-8"?>
<root>
  <email_record>
    <record_id>2001056312_2</record_id>
    <address>epriority_test@dstoutput.com</address>
    <subject>This is a test message</subject>
    <client_id>1105</client_id>
    <batch_id>2001056312</batch_id>
    <client_batch_id>test1456295456</client_batch_id>
    <email_id>2</email_id>
    <cpid>2</cpid>
    <cpid2 />
    <cpid3 />
    <creation_date>2008-05-22 19:03:38.631000</creation_date>
    <delivered_date>2008-05-22 19:05:59.184318</delivered_date>
    <receipt_date />
    <viewed_date>2008-05-22 19:06:29.184318</viewed_date>
    <replied_date />
    <clicked_date />
    <failed_date />
    <failed_code>0</failed_code>
    <failed_description />
    <profile_name>default</profile_name>
    <pprofileId>1001</pprofileId>
    <email>
Date: Thu, 22 May 2008 14:03:38 -0500 (CDT)
From: "Test" <test@dstoutput.com>
Subject: This is a test message
To: epriority_test@dstoutput.com
Message-ID: <2001056312.2@testtracking.epriority.com>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="MIMEBOUNDARY-MM0"
Importance: 3
X-MSMail-Priority: Normal
X-Priority: 3
User-Agent: eSolutions
X-MimeOLE: Produced by eSolutions

This is a MIME 1.0 compliant message.

If you are able to see this message, your
user agent is not MIME compliant.  You will
need an alternative mail viewer to read this
message in its entirety.

--MIMEBOUNDARY-MM0
Content-Type: multipart/alternative; boundary="MIMEBOUNDARY-MA0"


--MIMEBOUNDARY-MA0
Content-Type: text/plain; charset=windows-1252
Content-Transfer-Encoding: quoted-printable

Dear ePriority Test,

This is the text body of an e-mail message.
ePriority Development Group
DST Output, Inc.
test=40dstoutput.com


THIS IS THE TEXT BODY

--MIMEBOUNDARY-MA0
Content-Type: text/html; charset=windows-1252
Content-Transfer-Encoding: quoted-printable

<html>
<body>
<p>Dear ePriority Test,</p>
<p>This is the body of an e-mail message.</p>
<p>I am enclosing a secure html document entitled:  secure.html</p>
<p>Please download this document to your Desktop and open it using Inte=
rnet Explorer.</p>
<p>ePriority Development Group</p>
<p>DST Output, Inc.</p>
<p>test=40dstoutput.com</p>
</body>
</html>

--MIMEBOUNDARY-MA0--

--MIMEBOUNDARY-MM0--</email>
  </email_record>
</root>

Unsuccessful Record Request (invalid record_id)

<?xml version="1.0" encoding="ISO-8859-1"?>
<root />

Successful Rendered Email Content

Text/plain or HTML content of body with a text/plain or html mimetype accordingly. 

Unsuccessful Rendered Email Content

<root>
  <status>FAILED</status>
  <message>Could not parse email</message>
<root>

Java Example Up

import java.io.*;
import java.net.*;
import java.text.*;
import java.util.*;
import java.security.MessageDigest;
import javax.net.ssl.*;

public class EpriorityCsrLookup
{
  static int myAccountId = 12345;

  public static void main (String[] args)
  {
    try
    {
      // Prepare Authentication Credentials
      SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
      sdf.setTimeZone(TimeZone.getTimeZone("Universal"));
      String authDate = sdf.format(new Date());
      String webServicePw = args[0];
      String searchAddress = args[1];
      String digestString = authDate + webServicePw;
      MessageDigest md = MessageDigest.getInstance("SHA256");
      byte[] hash = md.digest( digestString.getBytes() );
      String hashHex = asHex( hash );


      // Prepare Content
      StringBuilder content = new StringBuilder();
      content.append("cid=");
      content.append(myAccountId);
      content.append("&authDate=");
      content.append(authDate);
      content.append("&authHash=");
      content.append(hashHex);
      content.append("&action=list");
      content.append("&addr=");
      content.append(searchAddress);


      // Connect to URL
      URL url = new URL ("https://www.epriority.com/EmailReports");

      URLConnection urlConn = url.openConnection();
      urlConn.setDoInput(true);
      urlConn.setDoOutput(true);
      urlConn.setUseCaches(false);
      urlConn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");


      // Send HTTP POST
      DataOutputStream printout = new DataOutputStream(urlConn.getOutputStream());
      printout.writeBytes (content.toString());
      printout.flush ();
      printout.close ();


      // Read XML Response
      BufferedReader input = new BufferedReader(new InputStreamReader(urlConn.getInputStream()));
      String str;
      while (null != ((str = input.readLine())))
      {
        System.out.println(str);
      }
      input.close ();
    }
    catch (Exception e)
    {
      System.out.println(e.getMessage());
    }
  }

  public static final String asHex(byte[] data)
  {
    //double size, two bytes (hex range) for one byte
    StringBuffer buf = new StringBuffer(data.length * 2);

    for (int i = 0; i < data.length; i++)
    {
      //don't forget the second hex digit
      if (((int) data[i] & 0xff) < 0x10)
      {
        buf.append("0");
      }

      buf.append(Long.toString((int) data[i] & 0xff, 16));
    }

    return buf.toString();
  }

}