Web Tool Login

HTML Sample

<form method="post" action="https://api.westfax.com/Polka.Api/REST/SendFax/XML" enctype="multipart/form-data">
  <table>
    <tr><td>Username:</td><td><input type="text" name="UserName" value="SampleUsername" /></td></tr>
    <tr><td>Password:</td><td><input type="text" name="Password" value="SamplePassword" /></td></tr>
    <tr><td>Product ID:</td><td><input type="text" name="ProductId" value="SampleGuid" /></td></tr>
    <tr><td>Phone Number 1:</td><td><input type="text" name="Numbers1" value="5555555555" /></td></tr>
    <tr><td>Job Name:</td><td><input type="text" name="JobName" value="Test Job" /></td></tr>
    <tr><td>Document 1:</td><td><input type="file" name="Files1" /></td></tr>
    <tr><td>Document 2:</td><td><input type="file" name="Files2" /></td></tr>
    <tr><td>Header:</td><td><input type="text" name="Header" value="Sample Header" /></td></tr>
    <tr><td>Billing Code:</td><td><input type="text" name="BillingCode" value="Sample Billing Code" /></td></tr>
    <tr><td>CSID:</td><td><input type="text" name="CSID" value="" /></td></tr>
    <tr><td>Fax Quality:</td><td><input type="text" name="FaxQuality" value="Normal" /></td></tr>
    <tr><td>Start Date:</td><td><input type="text" name="StartDate" value="03/04/2010 17:33:00" /></td></tr>
    <tr><td><input type="submit" name="Submit" value="Submit" /></td></tr>
  </table>
</form>

PHP Sample

<?php

$data = http_build_query(
    array
    (
      'Username' => 'SampleUsername',
      'Password' => 'SamplePassword',
      'ProductId' => '00000000-0000-0000-0000-000000000000',
      'Ids1' => '00000000-0000-0000-0000-000000000000',
    )
);


$opts = array('http' =>
    array
    (
      'method' => 'POST',
      'header' => 'Content-type: application/x-www-form-urlencoded',
      'content' => $data
    )
);


$context = stream_context_create($opts);
$result = file_get_contents('https://api.westfax.com/Polka.Api/REST/GetFaxStatus', false, $context);

print($result);

?>

C# Sample

string username = "SampleUsername";
string password = "SamplePassword";
Guid productId
= new Guid("00000000-0000-0000-0000-000000000000");
string jobName = "Job Name";
string billingCode = "Billing Code";
string header = "To: John Doe From: Jane Smith";
string[] phoneNumbers = new string[] { "5555555555" };
string CSID = "5555555555";
PolkaApi.FaxQuality faxQuality
= PolkaApi.FaxQuality.Normal;
DateTime startDateTime
= DateTime.UtcNow;
string feedbackEmail = "janesmith@company.com";
string filePath = @"C:\DocumentToBeFaxed.tif";

//
// Create the object for the fax document
//
PolkaApi.FileContainer fileContainer = new Polka.Api.DemoApp.PolkaApi.FileContainer();
fileContainer.Filename
= Path.GetFileName(filePath);
fileContainer.FileContents
= File.ReadAllBytes(filePath);
fileContainer.ContentLength
= fileContainer.FileContents.Length;

//
// Initialize the web servce
//
PolkaApi.SoapWebService webService = new Polka.Api.DemoApp.PolkaApi.SoapWebService();

webService.Url
= "https://api.westfax.com/Polka.Api/SOAP/";

try
{

  //
  // Submit the fax to the API
  //
  PolkaApi.ApiResultOfString result = webService.SendFax(username, password, productId, jobName, billingCode, header, phoneNumbers, new PolkaApi.FileContainer[] { fileContainer }, CSID, faxQuality, startDateTime, feedbackEmail);

  if (result.Success == true)
  {
    Console.WriteLine(
"Job Submitted Successfully!\r\n" + result.Result);
  }

  else
    Console.WriteLine(
"Job Submission Failed.\r\n" + result.ErrorString);
}

catch (Exception ex)
{
  Console.WriteLine(
"Job Submission Failed.\r\n" + ex.Message);
}
© 2010 WestFax, inc. | 5690 DTC Boulevard, Suite 670, Greenwood Village, CO 80111 | Toll-Free 800-473-6208 | Local 303-299-9329 | Fax 303-299-9309 | info@westfax.com