This API will allow for the download of reject files associated with prior uploads. The call will locate the requested reject file by a provided ID value and initiate the transfer of the file.
Authentication
Every HTTP request to the web service must be authenticated; in order to do so, every request must include three HTTP headers:
- Authorization
- Content-Type
- Date
The Date header must match the current date and time, and requests with dates too far in the future or past will be rejected. If you do not have control over the Date header, instead include the X-RealMagnet-Date header, which will be used in preference to the Date header. The Date header must be formatted as specified in the Date Format section of this document.
The Authorization header will have the following form
Authorization: RealMagnet MailUserID:Signature
The MailUserID will be assigned to your account by Higher Logic Thrive Marketing Enterprise (Thrive Marketing Enterprise), along with an APISecretKey. The Signature is computed by taking the HMAC-SHA1 of a specially constructed string, using the APISecretKey as the key. The following is a sample C# code to compute this signature:
var apiSecretKey = "wgn1zeQU0ybgkmPbu7gAuTnyniyEfE61VDd57Kwksw";
var http_method = "POST";
var http_contentMd5 = "15b3d3e87c1c8032fae05e5235af1206";
var http_contentType = "application/json;charset=utf-8";
var http_date = "Thu, 06 Dec 2012 16:56:14 GMT";
var http_customHeaders = ...
var http_requestUrl = "http://api105.magnetmail.net/v5/rest/rejectFile/".ToLowerInvariant();
var action = "";
var stringToSign = string.Format("{0}\n{1}\n{2}\n{3}\n{4}\n{5}\n{6}",
http_method.ToUpperInvariant(), http_contentMd5, http_contentType, http_date, http_customHeaders,
http_requestUrl, action);
var encoding = new UTF8Encoding(false);
var keyBytes = encoding.GetBytes(apiSecretKey);
var messageBytes = encoding.GetBytes(stringToSign);
var hmac = new HMACSHA1(keyBytes);
var hash = hmac.ComputeHash(messageBytes);
var signature = Convert.ToBase64String(hash);
return signature;
The value of http_customHeaders in the above sample is computed by concatenating, separated by newlines, the normalized form of all HTTP headers beginning with “X-RealMagnet-“. Headers are normalized by the following procedure:
- Only headers with name beginning with “X-RealMagnet-“ are included.
- Header name is converted to lower case.
- Header names are sorted lexicographically.
- Headers with multiple values are converted into a header with a single value that is a comma separated list (with no space preceding or trailing the comma); order must be maintained.
- Newlines are removed from header values.
- Header name is concatenated with header value, separated by a colon “:” (with no space between the header name and the colon, or between the colon and the header value).
- All header name/value pairs are concatenated into a single string, with a single newline between each pair and no additional space preceding or trailing the newline.
Important points to note:
- The HTTP Method is converted to all uppercase when computing the signature.
- The Content-Type and Date headers are included exactly as is in the HTTP request.
- The request URL must be converted to all lower case before computing the signature.
- The request URL in the example above is for the RESTful endpoint.
- A request to a REST endpoint will include an empty (blank) action when computing the signature.
- A request to a SOAP endpoint will include the soap action when computing the signature.
- The encoding must not add a BOM before computing the signature; hence, var encoding = new UTF8Encoding(false); is used.
Operations
RetrieveRejectFile
Description
This call will begin the download of the file associated with the provided reject file ID.
Parameters
The following parameter is required.
- Name: rejectId
- Type: String
- Value Range: Any valid reject file ID provided from the Upload and Send or File Upload API.
Response object
There is no custom response object carrying a Data Contract. The method will return a stream recoverable from the Web response stream that can be used to stream all reject file data down to a local data file or other resource.
Example Header Information for Reject File Download
HTTP/1.1 200 OK
Content-Length: 58915280
Content-Type: application/octet-stream
Server: Microsoft-HTTPAPI/2.0
Content-Disposition: attachment; filename=FKJDL_491280_2015-02-27T041504-6907.rej
Date: Wed, 28 Sep 2016 15:31:42 GMT
Constraints
This call is subject to the following constraints:
- All parameters must match the value ranges as specified in this document.
- The ID provided for the reject file must be valid.
- The ID provided for the reject file must be owned by the authenticated account.
REST endpoint
The REST endpoint is located at http://api105.magnetmail.net/v5/rest/rejectfile/, and uses the GET HTTP method. A sample REST request is below.
GET http://api105.magnetmail.net/v5/rest/rejectFile/38820021 HTTP/1.1
Date: Wed, 28 Sep 2016 15:25:45 GMT
Content-Type: application/json
Authorization: RealMagnet YourAccount:3rgstagVQw0Lq1ogIc89UuuBgiE=
Host: api105.magnetmail.net
Connection: Keep-Alive
Date format
The date and time specified in the HTTP Date header (or the X-RealMagnet-Date header, if specified), should match the format described by the grammar below (based on RFC 1123 and HTTP/1.1):
full-date = day-name "," SP date SP time SP "GMT"
date = 2DIGIT SP month SP 4DIGIT
; day month year (e.g. 02 Jan 2012)
time = 2DIGIT ":" 2DIGIT ":" 2DIGIT
; hours minutes seconds, 24-hour format (e.g. 23:59:59)
day-name = "Sun" | "Mon" | "Tue" | "Wed" | "Thu" | "Fri" | "Sat"
month = "Jan" | "Feb" | "Mar" | "Apr" | "May" | "Jun"
| "Jul" | "Aug" | "Sep" | "Oct" | "Nov" | "Dec"
DIGIT = <any single digit, 0 - 9>
SP = <ASCII 32, the space character>
For the purposes of this API, midnight is considered the first second of the day; that is, “Mon, 02 Jan 2012 00:00:00 GMT” is preceded by “Sun, 01 Jan 2012 23:59:59 GMT” and followed by “Mon, 02 Jan 2012 00:00:01 GMT”