Report 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

Reports created at ePriority.com may be requested by name through an HTTPS query. If the report uses a batch data source, a batch name or id must also be specified. Errors may occur when bad credentials are supplied or incorrect/incomplete data is given in the report 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 Report 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.
report Allowed: a-z, A-Z, 0-9, underscore
Length: 1-34
Report name. Cannot contain spaces.
bid The ePriority internal Batch ID (Batch reports only). The cbid may be supplied instead of the bid.
cbid Client Batch ID (Batch reports only). The bid may be supplied instead of the cbid.

The following parameters are optional:

timezone Must be a standard Timezone Abbreviation.
The time zone for all dates in the report. Specifying the time zone overrides the default time zone for a report. A list of accepted timezones is provided below. If the timezone cannot be interpreted, dates will be displayed in GMT.
start Must be (yyyy-mm-dd) format.
The start date (Account reports only). Must be used with the stop date. If start and stop dates are not supplied, the last full calendar month of data will be used.
stop Must be (yyyy-mm-dd) format.
The stop date (Account reports only). Must be used with the start date. If start and stop dates are not supplied, the last full calendar month of data will be used.

It is recommended that you URL-Encode your query string prior to submission.


Authentication Up

All requests must be secure (HTTPS) and contain the three parameters required for authentication:

  1. cid (ePriority Client ID)
  2. authDate (authentication date - newly created for each request)
  3. authHash (HMAC-SHA256 hexidecimal string)

A Keyed-Hash Message Authentication Code (HMAC), the request signature, is calculated using the Web API Password (secret key) for the supplied Client ID and the value of the authDate parameter as input. Your Project Manager or Client Services Liaison will provide your Web API Password.

The Authentication Date must follow the ISO 8601 format: YYYY-MM-DDThh:mm:ss (eg 1997-07-16T19:20:30)

To generate the HMAC-SHA256 hash value (32 hexidecimal digit string), apply the SHA256 function to a string composed of your Web API Password appended to the authDate parameter value.

ex: web api password = pass5239900
    authDate = 1997-07-16T19:20:30
    authHash = SHA256.hexValue( "1997-07-16T19:20:30pass5239900" )

Note that your request will expire 24 hours after creation (UTC) and authentication will fail. This ensures that a valid request cannot be stolen and used indefinitely for other API calls.


Using the Report Service Up

Once you have created a report, it may be requested through the HTTP service at any time.

Note that the Content-type returned to your application (the HTTP response) with be the same as the output method specified in the <xsl:output> 'method' attribute of your report's XSL Stylesheet.


Batch Report Example Up

https://www.epriority.com/Reports?
  cid=1234&report=XML_bounce_report&version=1&
  bid=1234567&timezone=US/Eastern&authDate=1997-07-16T19:20:30&
  authHash=a19671a63d786d1314b28f2a58e3c4e8

Line breaks and spaces would not be present in an actual query.


Account Report Example Up

https://www.epriority.com/Reports?version=1&
  cid=1234&report=statements_profile__report&
  start=2003-12-01&stop=2003-12-17&authDate=1997-07-16T19:20:30&
  authHash=a19671a63d786d1314b28f2a58e3c4e8

Line breaks and spaces would not be present in an actual query.


Error Format Up

When an error occurs due to invalid query data or credentials, the HTTP response Content-type is 'text/plain' and begins with the word 'ERROR', followed by a text message.


Java Example Up

import java.io.*;
import java.net.URL;
import java.security.MessageDigest;
import java.text.*;
import java.util.*;

public class epriorityReportReader
{
  public static void main(String[] args) throws Exception
  {
    int cid = 1234;
    String report = "batch_status";
    String version = "1";
    String bid = args[0];

    // authentication values
    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
    sdf.setTimeZone(TimeZone.getTimeZone("Universal"));
    String date = sdf.format(new Date());
    String password = getApiPassword();
    String digestString = date + password;
    MessageDigest md = MessageDigest.getInstance("SHA256");
    byte[] hash = md.digest( digestString.getBytes() );
    String hashHex = asHex( hash );

    // URL class provides encoding
    URL epriority = new URL("https://www.epriority.com/" +
        "Reports?cid=" + cid +
        "&report=" + report +
        "&version=" + version +
        "&authDate=" + date +
        "&authHash=" + hashHex +
        "&bid=" + bid);

    BufferedReader in = new BufferedReader(
      new InputStreamReader(epriority.openStream()));

    String inputLine;

    while ((inputLine = in.readLine()) != null)
    {
      if (inputLine.matches("failed"))
      {
        // do something
      }
    }

    in.close();
  }

  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();
  }

}

Perl Example Up

#!/usr/bin/perl

use Net::SSLeay::Handle qw(shutdown);
use URI::Escape;
use Digest::SHA256 qw(hexhash);
use POSIX qw(strftime);

my $cid = "1234";
my $report = "XML_bounce_report";
my $version = "1";
my $timezone = "US/Central";
my $bid = shift;
my $password = shift;
my $datetime = strftime("%Y-%m-%dT%H:%M:%S", gmtime());
my $auth = hexhash("$datetime$password");

my ($host, $port) = ("www.epriority.com", 443);

tie (*SSL, "Net::SSLeay::Handle", $host, $port);

my $location = uri_escape("/Reports?cid=$cid&&authDate=$datetime&authHash=$auth&" .
   "report=$report&version=$version&bid=$bid&timezone=$timezone";

print SSL "GET $location\r\n\r\n";

shutdown(\*SSL, 1);

while (<SSL>)
{
  /<status>([\w\/]+)<\/status>/ or next;
  if ($1 eq "failed")
  {
    # do something ...
  }
}

close SSL;


Time Zones Up

US/Samoa US/Hawaii US/Alaska
US/Pacific US/Mountain US/Central
US/Eastern America/Bogota America/Guayaquil
America/Havana America/Lima America/Rio_Branco
America/Asuncion America/Caracas America/Guyana
America/La_Paz America/Santiago Atlantic/Stanley
America/Puerto_Rico Brazil/West Canada/Atlantic
Canada/Newfoundland America/Buenos_Aires Brazil/East
America/Scoresbysund Atlantic/Azores Atlantic/Cape_Verde
Greenwich Portugal Universal
Europe/Berlin Africa/Johannesburg Africa/Kigali
Asia/Tel_Aviv Europe/Istanbul Africa/Nairobi
Asia/Baghdad Europe/Moscow Asia/Tehran
Asia/Baku Asia/Dubai Asia/Yerevan
Asia/Ashkhabad Asia/Karachi Asia/Calcutta
Asia/Katmandu Asia/Dhaka Asia/Bangkok
Asia/Jakarta Asia/Saigon Asia/Hong_Kong
Asia/Manila Asia/Shanghai Asia/Singapore
Australia/West Asia/Seoul Asia/Tokyo
Australia/North Australia/South Australia/Brisbane
Australia/Sydney Australia/Tasmania Asia/Magadan
Pacific/Guadalcanal Pacific/Auckland Pacific/Fiji
Pacific/Kwajalein