Mail Merge REST Overview

The Softlinx Cloud Mail Merge REST API provides a simplified API for creating mail merge jobs and retrieving the status of the job and resulting faxes. Requests are made over a secured HTTPS connection.

A mail merge job requires two files, a fax metadata file that contains data to be substituted in a PDF form and the PDF form itself. The fax metadata file must be a CSV file where the first line contains the column headings. One of the columns must contain the destination fax numbers. During the processing of the mail merge job, each line in the metadata file is read and the values in each column are substituted into corresponding named fields in the PDF form. The resulting PDF file is sent as a fax.

The mail merge API allows for the creation of a mail merge job and the ability to check its status. Additionally, with the API, you can get a list of all the faxes resulting from the mail merge job. Each fax has a status that will indicate whether the fax has been successfully sent or had an error.

Getting Started

A quick way to get started with the mail merge API is to download the sample CSV file and PDF template. Open the readme file and change the credentials. You will need curl.exe to execute the sample API call.

Mail Merge REST API Resources

DescriptionURL
Create a Job. POST /Job
CSV {Binary Data for CSV}
Template {Binary Data for PDF Template}
ExpectedFaxes={integer}
FaxNumerColumnName={string}
KeywordColumnName={string}
SendAfter={datetime}
BarcodeColumnName={string}
CoverPageMessage={string}
NotifyOnSuccess={‘true’ or ‘false’}
NotifyOnFailure={‘true’ or ‘false’}
NotifyEmail={string}
Get a List of All Mail Merge Jobs GET /Job
Get Status of a Job. GET /Job/{JOBID}
Get List of Faxes in a Job. GET /Job/{JOBID}/Faxes

Base URL

The base URL is "https://api-mm.rpxtest.com/softlinx/mailmerge/v1". The "v1" denotes version 1 of the APIs. The APIs are documented relative to the base URL, e.g., for creating a mail merge job the documented URL is /Job so the real URL is https://api-mm.rpxtest.com/softlinx/mailmerge/v1/Job.

The URL above is for the Softlinx Cloud Fax test environment. A production URL is provided as part of the customer onboarding process.

HTTP submission method

The HTTP method is denoted with GET, POST, PUT, or DELETE keywords.

API arguments

The API parameters can be passed in QUERY_STRING or in the body of the request using "www-form-urlencoded" or "form-data" formats. Both formats are standard form/url submission formats used by browsers. The "application/www-form-urlencoded" body contains multiple parameters "key=value&key=value..." whereas "form-data" is multipart/form-data contains one parameter per MIME part and is usually used to send attachments.

Arguments are case sensitive and unrecognized arguments are ignored.

Client credentials

The client user ID and password is passed to the API using the Basic Authentication header.

REST API responses

Response HTTP code:

  • 200 OK for success. Most responses should return 200.
  • 401 Authentication failure Unauthorized - bad username or password
  • 403 Forbidden access denied to a resource
  • 400 Bad Request - Client errors in parameters/URLs
  • 404 Not Found missing resource
  • 500 Server Error - Server processing errors

Response body

All responses return JSON data (application/json). ALL JSON responses contain "RequestStatus" object with StatusCode (0 for success), StatusText members. e.g.,

...
"RequestStatus" : {
   "StatusCode" : 0,
   "StatusText" : ""
 }

Create a Mail Merge Job

A mail merge job requires a CSV file containing fax metadata and a PDF form. The first line on the CSV file must contain the column headings. When a column name matches a name of a PDF field, the value in that column will be put into the form field when the fax image is created.

The CSV, Template, and FaxNumerColumnName arguments are required.

If the barcode column name is specified, then there needs to be a corresponding image field in the PDF with the same name. A PDF417 barcode will be placed at the location of the image field. The field's attribute should be set to hidden. The size of the barcode is fixed and will not change based on the image field size.

Request:

HTTP:

POST /softlinx/mailmerge/v1/Job HTTP/1.1
Host: api-mm.rpxtest.com
Authorization: Basic XXX
Cache-Control: no-cache
Postman-Token: e8b3e52c-8b3e-6f24-bacc-984fce9f43f6
Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW

------WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="ExpectedFaxes"

10

------WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="CSV"; filename="meta_10.csv"
Content-Type: application/vnd.ms-excel


------WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="Template"; filename="mm1f.pdf"
Content-Type: application/pdf


------WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="FaxNumerColumnName"

faxnum
------WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="KeywordColumnName"

internal_id
------WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="BarcodeColumnName"

barcode
------WebKitFormBoundary7MA4YWxkTrZu0gW--

cURL:

curl https://api-mm.rpxtest.com/softlinx/mailmerge/v1/Job -F FaxNumerColumnName=faxnum -F CSV=@<
filename
> -F Template=@<
filename
> -u <
username@organization
>:<
password
>

Response:

HTTP/1.1 201
Content-Length: 
length
Content-Type: application/json; charset=utf-8 { "JobID":63, "RequestStatus": { "StatusCode":0, "StatusText":"" } }

POST /Job

Arguments


NameTypeDescription
CSVbinary-required- Contents of CSV file.
Templatebinary-required- Contents of PDF Form file.
FaxNumerColumnNamestring-required- Name of column in the CSV file that corresponds to the fax number.
ExpectedFaxesintegerNumber of faxes to be created. This should match the number of lines in the csv (excluding the first line).
KeywordColumnNamestringName of column in the CSV file that corresponds to the keyword for the fax.
BarcodeColumnNamestringName of column in the CSV file that corresponds to a barcode value. This should map to an image field in the PDF.
SendAfterDate/time after which to attempt to send the fax. If missing, attempts to send as soon as possible.

datetime

Description

The valid formats for date/time parameters are a subset of the ISO 8601 specification:

YYYY-MM-DDThh:mmTZ or YYYY-MM-DDThh:mm:ssTZ, where TZ is the time zone and the format of this is either "Z" or (+|-)hh:mm. The “:” between the hour and minutes in the time zone is optional. Examples are:

  • 2010-01-31T13:30:45Z "Z" stands for GMT time zone
  • 2010-01-31T14:30:45+01:00
  • 2010-01-31T13:30:45-0500
*** ReplixFax assumes UTC time, so the "Z" indicator should be used when specifying times. ***
CoverPagestringName of cover page to use. If not set, then no cover page will be used. Set to ‘default’ to use the user’s default cover page.
CoverPageMessagestringText to put into the cover page message field. Will be ignored if no cover page is specified.
NotifyOnSuccessstring"true" or "false". If not specified, then the default setting for the user will be used.
NotifyOnFailurestring"true" or "false". If not specified, then the default setting for the user will be used.
NotifyEmailstringEmail address to receive notifications of fax statuses.

Response

NameTypeDescription
JobIDintegerMail Merge Job ID
RequestStatusCheck for StatusCode = "0" to verify that request executed correctly.

RequestStatus

NameTypeDescription
StatusCodeError number.

NonNegativeInt

TypeDescription
stringAn integer greater than or equal to 0.
StatusTextstringDescription of error.

Potential Errors

Status CodeStatus Text
1000'ExpectedFaxes' value is not a valid number.
1001'FaxNumerColumnName' not specified.
1002No files in request.
1003CSV file not specified.
1004Template file not specified.
1005'SendAfter' is invalid.
1006'NotifyOnSuccess' is invalid.
1007'NotifyEmailFailure' is invalid.
1100Could not validate files.
1001No fields found in PDF template.
1102No fields found in CSV file.
1103Could not find fax number column named {???} in metadata file.
1104Could not find keyword column named {???} in metadata file.
1105Could not find barcode column named {???} in metadata file.
1106Expected faxes {???} does not match lines in meta file {???}
1200Error: {details}
1300Exception: {details}

Mail Merge Job Status

All mail merge jobs go through a process where each line in the CSV is read and a corresponding outbound fax is created with a merged PDF file. The fields in the PDF will contain the corresponding values in the row of the CSV file.

As each line in the CSV file is processed, the current line number for the mail merge job is updated. While the CSV file is being processed, the job status will be "INPROCESS".

When all lines of the CSV file are processed, the status will be "COMPLETE". This does not mean that all faxes have been sent. It means that all fax requests have been created. Each fax request goes through an independent process of sending.

A mail merge job can be cancelled prior to all of its lines being processed and a corresponding fax is generated. If a job is cancelled, its status will be "CANCELLED".

Request:

HTTP:

GET /softlinx/mailmerge/v1/Job/23 HTTP/1.1
Host: api-mm.rpxtest.com
Authorization: Basic XXX
Cache-Control: no-cache
Postman-Token: ba0fed50-c129-21f3-31e3-bdfef97dd4fc


cURL:

curl https://api-mm.rpxtest.com/softlinx/mailmerge/v1/Job/23   -u <
username@organization
>:<
password
>

Response:


"Job":
{
"ID":23,
"CreatedOn":"2018-10-18T19:47:42",
"LastCompletedLine":10000,
"Status":"COMPLETE",
"CancelledOn":null,
"ExpectedFaxCount":0
},
"RequestStatus":
{
"StatusCode":0,"StatusText":""
}
}

GET/Job/{Job ID}

Response

NameTypeDescription
JobsInformation about each mail merge job.

Job

NameTypeDescription
IDintegerMail Merge Job ID
CreatedOndatetimeDate and time of when job was created.
LastCompletedLineintegerLast line of CSV file that was processed.
StatusInformation about each fax.

Job Status

StatusDescription
INPROCESSThe CSV file is being processed and faxes are being generated.
COMPLETEAll requests faxes have been generated. This does not mean the faxes have been sent.
CANCELLEDThe mail merge job was cancelled before all fax requests were created.
CancelledOnintegerDate and time of when the job was cancelled.
ExpectedFaxCountintegerNumber of faxes expected to be created.
RequestStatusCheck for StatusCode = "0" to verify that request executed correctly.

RequestStatus

NameTypeDescription
StatusCodeError number.

NonNegativeInt

TypeDescription
stringAn integer greater than or equal to 0.
StatusTextstringDescription of error.

Potential Errors

Status CodeStatus Text
2001Error getting the job. {details}

Faxes from Mail Merge Job

List all Mail Merge Jobs

Request:

HTTP:

GET /softlinx/mailmerge/v1/Job/23 HTTP/1.1
Host: api-mm.rpxtest.com
Authorization: Basic XXX
Cache-Control: no-cache
Postman-Token: ba0fed50-c129-21f3-31e3-bdfef97dd4fc


cURL:

curl https://api-mm.rpxtest.com/softlinx/mailmerge/v1/Job/23/Faxes   -u <
username@organization
>:<
password
>

Response:

{
"Faxes":
[
{
"ID":41253,
"CreatedOn":"2018-02-15T16:30:28",
"Status":"Submitted",
"ErrorCode":"0",
"ErrorText":"",
"Keyword":"",
"FaxNumber":"1",
"ModifiedOn":"2018-02-15T16:30:28",
"Owner":"seth"
}
,
{
"ID":41254,
"CreatedOn":"2018-02-15T16:30:29",
"Status":"Submitted",
"ErrorCode":"0",
"ErrorText":"",
"Keyword":"",
"FaxNumber":"2",
"ModifiedOn":"2018-02-15T16:30:29",
"Owner":"seth"
}
],
"RequestStatus":
{
"StatusCode":0,"StatusText":""
}
}

GET/Job/{Job ID}/Faxes

Response

NameTypeDescription
FaxesInformation about each fax.

Faxes

 
NameTypeDescription
IDintegerFax Job ID
CreatedOn Datetime of when the fax was created.

datetime

Description

The valid formats for date/time parameters are a subset of the ISO 8601 specification:

YYYY-MM-DDThh:mmTZ or YYYY-MM-DDThh:mm:ssTZ, where TZ is the time zone and the format of this is either "Z" or (+|-)hh:mm. The “:” between the hour and minutes in the time zone is optional. Examples are:

  • 2010-01-31T13:30:45Z "Z" stands for GMT time zone
  • 2010-01-31T14:30:45+01:00
  • 2010-01-31T13:30:45-0500
*** ReplixFax assumes UTC time, so the "Z" indicator should be used when specifying times. ***
FaxStatusStatus of fax.

SendFaxStatus

ValuesDescription
sentSent Faxes.
sendFailedFaxes that cannot be sent.
awaitingConversionFaxes waiting to be converted to TIFF Fax format.
awaitingCoverpageFaxes waiting for a cover page template.
scheduledFaxes waiting to be sent.
sendingFaxes in the process of being sent.
ErrorCodeNumeric error code of the error encountered by the fax server backend.

Send Errors

Error CodeError Text (may vary with same error code)Cause
0Cannot retrieve record … No record foundSystem issue.
 Cannot open fax file.System issue.
 Unable to retrieve user info.System issue.
 Cannot combine fax files.System issue.
 Invalid phone number. Missing digits.System issue.
1000Call rejectedPotentially recipient rejected call.
 Temporary failureTelco network unavailable.
 Cannot open fax file.System issue.
 Answer - Marked by SilencePotentially is not a fax number.
 Retrieve fax file failedSystem issue.
 Dial TonePotentially is not a fax number.
 RMTOFFHOOKTelco issue.
 Recovery on timer expirationTelco issue.
 Network read: Network read. 10054:Connection reset.System issue.
 Unallocated numberTelco issue.
 Network out of orderTelco issue.
 Dial: Call collision detected.Telco issue.
 Service not implemented; unspecifiedTelco issue.
 Interrupted. Server shutdownSystem issue.
 Coverpage and fax merge failed.System issue.
 Invalid phone number. Missing digits.Invalid fax number.
 Cannot retrieve fax files.System issue.
 Custom IMG not member of configured IMGsSystem issue.
 Invalid number formatInvalid fax number.
 Transmission errorTelco issue.
1002BusyBusy
1003Circuits BusyTemporary problem establishing a call.
1004No answerRing, but no answer.
1005No fax tonePotentially is not a fax number.
1009sit intercept toneTelco network busy.
 sit vacant toneTelco issue.
 sit no circuit toneTelco issue.
 sit reorder toneTelco issue.
1041Fax number rejected by fax server fax number restriction …Intentionally blocked fax number.
1100Call answered. Possibly by a personPotentially is not a fax number.
1101Dial - no answer from central officePotentially is not a fax number.
1102Dial - call disconnectedProblem establishing a call.
1103fax processing excessive durationFax file may be too large.
3002FaxBegin/FaxEndDoc/FaxRemoteInfo/FaxSendPage/FaxTraining … Page ? rejected by recipient. ConfVal …Fax transmission issue.
3002FaxBegin/FaxEndDoc/FaxRemoteInfo/FaxSendPage/FaxTraining … Fax transmission issue.
 Page ? rejected by recipient. ConfVal …Fax transmission issue.
 TiffNextPage …Fax transmission issue.
4001Error converting document to FAX.Fax input file invalid.
ErrorTextstringText string corresponding to ErrorCode, empty for no error.
KeywordintegerKeyword as specified in the CSV file.
FaxNumberstringOutbound fax number as specified in the CSV file.
ModifiedOn Datetime of when the fax was last modified. If the fax's status is sent, then this is the time the fax was sent.

datetime

Description

The valid formats for date/time parameters are a subset of the ISO 8601 specification:

YYYY-MM-DDThh:mmTZ or YYYY-MM-DDThh:mm:ssTZ, where TZ is the time zone and the format of this is either "Z" or (+|-)hh:mm. The “:” between the hour and minutes in the time zone is optional. Examples are:

  • 2010-01-31T13:30:45Z "Z" stands for GMT time zone
  • 2010-01-31T14:30:45+01:00
  • 2010-01-31T13:30:45-0500
*** ReplixFax assumes UTC time, so the "Z" indicator should be used when specifying times. ***
OwnerstringFax user ID.
RequestStatusCheck for StatusCode = "0" to verify that request executed correctly.

RequestStatus

NameTypeDescription
StatusCodeError number.

NonNegativeInt

TypeDescription
stringAn integer greater than or equal to 0.
StatusTextstringDescription of error.
RequestStatusCheck for StatusCode = "0" to verify that request executed correctly.

RequestStatus

NameTypeDescription
StatusCodeError number.

NonNegativeInt

TypeDescription
stringAn integer greater than or equal to 0.
StatusTextstringDescription of error.

Potential Errors

Status CodeStatus Text
2001Error getting the fax list. {details}

Mail Merge Jobs

List all Mail Merge Jobs

Request:

HTTP:

GET /softlinx/mailmerge/v1/Job/23 HTTP/1.1
Host: api-mm.rpxtest.com
Authorization: Basic XXX
Cache-Control: no-cache
Postman-Token: ba0fed50-c129-21f3-31e3-bdfef97dd4fc


cURL:

curl https://api-mm.rpxtest.com/softlinx/mailmerge/v1/Job -G  -u <
username@organization
>:<
password
>

Response:

{
"Jobs":
[
{
"ID":22,
"CreatedOn":"2018-10-18T16:49:59",
"LastCompletedLine":0,
"Status":"CANCELLED",
"CancelledOn":null,
"ExpectedFaxCount":0
},
{
"ID":23,
"CreatedOn":"2018-10-18T19:47:42",
"LastCompletedLine":10000,
"Status":"COMPLETE",
"CancelledOn":null,
"ExpectedFaxCount":0
}
],
"RequestStatus":
{
"StatusCode":0,
"StatusText":""
}
}

GET/Job

Response

NameTypeDescription
JobsInformation about each mail merge job.

Job

NameTypeDescription
IDintegerMail Merge Job ID
CreatedOndatetimeDate and time of when job was created.
LastCompletedLineintegerLast line of CSV file that was processed.
StatusInformation about each fax.

Job Status

StatusDescription
INPROCESSThe CSV file is being processed and faxes are being generated.
COMPLETEAll requests faxes have been generated. This does not mean the faxes have been sent.
CANCELLEDThe mail merge job was cancelled before all fax requests were created.
CancelledOnintegerDAte and time of when the job was cancelled.
ExpectedFaxCountintegerNumber of faxes expected to be created.
RequestStatusCheck for StatusCode = "0" to verify that request executed correctly.

RequestStatus

NameTypeDescription
StatusCodeError number.

NonNegativeInt

TypeDescription
stringAn integer greater than or equal to 0.
StatusTextstringDescription of error.
RequestStatusCheck for StatusCode = "0" to verify that request executed correctly.

RequestStatus

NameTypeDescription
StatusCodeError number.

NonNegativeInt

TypeDescription
stringAn integer greater than or equal to 0.
StatusTextstringDescription of error.

Potential Errors

Status CodeStatus Text
2000Error getting the fax list Error getting job list. {details}