Queue a fax for delivery
POST Variables
Variable Name | Var Type | Type | Description |
action | String | Required | Must be “Queue_Fax” |
access_id | Integer | Required | Account Number |
access_pwd | String | Required | Password on the user’s account |
sCallerID | Integer | Required | Sender’s Fax Number (must be 10 digits) |
sSenderEmail | String | Required | Sender’s Email Address |
sFaxType | String | Required | “SINGLE” or “BROADCAST” |
sToFaxNumber | String | Required | 11 digit number or up to 50 11 digit fax numbers separated by a “|” (pipe) |
sResponseFormat | String | Optional | “XML” or “JSON” – Default is JSON |
sAccountCode | String | Optional | Internal Reference Number (Maximum of 20 characters) |
sRetries | Integer | Optional | Number of times the system is to retry a number if busy or an error is encountered – number from 0 to 6 |
sCoverPage | String | Optional | If you want to use one of the cover ages on file, specify the cover page you wish to use: “Basic”, “Standard”, “Company”, or “Personal”To use French cover pages, use: “Basicfr”, “Standardfr”, “Companyfr”, or “Personalfr”If a cover page is not provided then all cover page variables will be ignored.NOTE: If the default cover page on the account is set to “Attachments ONLY” the cover page will not be created irrespective of this variable |
sFaxFromHeader | String | Optional | From: On the Fax Header Line(Maximum of 50 characters) |
sCPFromName | String | Optional | Sender’s name on the Cover Page |
sCPToName | String | Optional | Recipient’s name on the Cover Page |
sCPOrganization | String | Optional | Organiation on the Cover Page |
sCPSubject | String | Optional | Subject Line on the Cover Page ** |
sCPComments | String | Optional | Comments placed in the body of the Cover Page |
sFileName_x* | String | Optional*** | Valid File Name – We support in excess of 156 different file types, including .zip. Check out our FAQs here to see a list of supported file types |
sFileContent_x* | String (Base64 Encoded) | Optional*** | Base64 encoding of file contents |
sNotifyURL | String | Optional | Provide an absolute URL (beginning with https:// or https://) and the SRFax system will POST back the fax status record when the fax completes. (See below for more details). Maximum of 110 characters allowed |
sQueueFaxDate | String | Optional | The date you want to schedule a future fax for. Must be in the format YYYY-MM-DD. Required if using sQueueFaxTime |
sQueueFaxTime | String | Optional | The time you want to schedule a future fax for. Must be in the format HH:MM, using 24 hour time (ie, 00:00 – 23:59). Required if using sQueueFaxTime |
NOTES:
- *You are able to send an unlimited number of files with their content – simply
replace the “x” with the number order you wish the files to be faxed in. Please
ensure that the sFileName_1 has content in sFileContent_1 etc. - **The subject line details are saved in the fax record even is a cover page is
not requested – so the subject can be used for filtering / searching - *** sFilename_x and sFileContent_x are both required when submitting files as part of your fax
- You are able to send a fax with just the cover page details.
- sQueueFaxDate/sQueueFaxTime must be for a future time. The timezone set on the account will be used when scheduling.
Returned Variables (JSON or XML Encoded)
Status | string | “Success” or “Failed” |
Result | string | Queued Fax ID (FaxDetailsID) or Reason for failure |
NOTIFY URL POST Response
If the sNotifyURL is provided in the initial Queue_Fax call, the same variables returned
from Get_Fax_Status will be sent the URL you provide as POST variables. At any
time you are still able to poll the fax status by calling Get_Fax_Status if the sNotifyURL is
missed for any reason. The variables sent are as follows:
Variable Name | Var Type | Size | Description |
FaxDetailsID | Integer | – | Fax Job ID |
FileName | String | 50 | Name of the fax file |
SentStatus | String | 15 | Status of the fax |
AccountCode | String | 20 | Account Code provided when fax was scheduled |
DateQueued | String | – | Date the fax was queued for delivery |
DateSent | String | – | Date the fax was sent |
ToFaxNumber | String | 20 | Recipient Fax Number |
Pages | Integer | – | Total number of pages |
Duration | Integer | – | Call length for transmission |
RemoteID | String | 40 | Remote Fax ID |
ErrorCode | String | 75 | Error message in the event of a failed fax |
Size | Integer | – | Size of the file |
NOTES:
- You have to setup the URL provided in sNotifyURL so that it can handle a POST of the variables listed above
- The DateQueued and DateSent variables will reflect your accountds timzone settings
- The error code will be a string describing the error encountered. There is a wide range of possible errors, the most frequent of which are “No Answer”, “Busy”, and “No Remote Fax”
Examples
PHP using cURL
-
<?php
-
‘action’ => ‘Queue_Fax’,
-
‘access_id’ => ‘12345’,
-
‘access_pwd’ => ‘myPassword’,
-
‘sCallerID’ => ‘5551234567’,
-
‘sSenderEmail’ => ‘myfax [at] example [dot] com’,
-
‘sFaxType’ => ‘SINGLE’,
-
‘sToFaxNumber’ => ‘15554567890’,
-
‘sCoverPage’ => ‘Basic’,
-
‘sCPSubject’ => ‘My Test Fax’,
-
‘sCPComments’ => ‘This is my text fax via the SRFax API!’,
-
‘sFileName_1’ => ‘MyFax.txt’,
-
);
-
CURLOPT_POST => 1,
-
CURLOPT_HEADER => 0,
-
CURLOPT_URL => “https://secure.srfax.com/SRF_SecWebSvc.php”,
-
CURLOPT_FRESH_CONNECT => 1,
-
CURLOPT_RETURNTRANSFER => 1,
-
CURLOPT_FORBID_REUSE => 1,
-
CURLOPT_TIMEOUT => 60,
-
CURLOPT_SSL_VERIFYPEER => true,
-
CURLOPT_SSL_VERIFYHOST => 2,
-
);
-
}
-
else {
-
}
-
?>
PHP using SRFax Object
-
<?php
-
require_once (“srFax_class.php”);
-
$accountID = “12345”;
-
$accountPassword = “myPassword”;
-
// instantiate object with Account ID and Password
-
$srFax = new srFax ( $accountID, $accountPassword );
-
//Get file contents for the fax
-
$file1Name = “myFax.txt”;
-
//Setup required variables
-
$senderFaxNumber = “5551234567”;
-
$senderEmail = “myfax [at] example [dot] com”;
-
$receiverFaxNumber = “15554567890”;
-
try {
-
// attempt to queue a fax
-
‘sCallerID’ => $senderFaxNumber,
-
‘sSenderEmail’ => $senderEmail,
-
‘sFaxType’ => ‘SINGLE’,
-
‘sToFaxNumber’ => $receiverFaxNumber,
-
‘sFileName_1’ => $file1Name,
-
‘sFileContent_1’ => $file1Contents,
-
‘sCoverPage’ => ‘Basic’,
-
‘sCPSubject’ => “My Test Fax”,
-
‘sCPComments’ => “This is my text fax via the SRFax API!”
-
));
-
}
-
catch (Exception $e) { // display error when exception is thrown
-
}
-
if ( $srFax->getRequestStatus () ) {
-
echo “Success! Fax Details ID = “ . $srFax->getRequestResponse ();
-
} else {
-
echo “ERROR: “ . $srFax->getRequestResponse ();
-
}
-
?>