Method PostUtilitiesAccountSearchByPhone

Summary

Search for a utility account by Phone Number

Remarks

You can send in the full phone number into the phone field. It will parse it into area code and phone number. Dashes will be removed for search.

Input Parameters

NameTypeLengthDescription
areaCode numeric 3 Phone area code
phone numeric 10 Phone number. If the area code is included, it will fill in the areaCode value.
rows numeric 3 Number of matching rows to return
active yn 0 Y/N Return active records only?

Example

POST http://localhost/FusionServices/v2/Naviline/Utilities/Search/ByPhone

Return Values

NameDescription
Customer The customer number for the account. The customer number and location number together make up the account number used by most other services to identify the customer’s account.
Location The location number for the account. Location number is the second part of the account number used to identify the customer’s account.
LocationAddress Location street address
CustomerName The customer’s name. For residential accounts, it should be in the format LAST, FIRST. For commercial accounts, it will be the business name.
DriverLicenseNumber Driver License Number found
SSN Social security number
Misc1Description Misc data 1 description
Misc1Date Misc data 1 date
Misc1Number Misc data 1 number
Misc1UserDefined Misc data 1 user defined value
Misc2Description Misc data 12description
Misc2Date Misc data 2 date
Misc2Number Misc data 2 number
Misc2UserDefined Misc data 2 user defined value
Confidential Indicates if the customer information is restricted and should not be given out or displayed. Y=Yes, N=No
CashOnly Indicates if the customer is required to make all payments in cash only. Y=Yes N=No
Status The status of the account. The account status codes and their descriptions are: A = Active, C = Collections, D = Deleted, F = Finalled, I = Inactive, S = Shutoff, T = Terminated, N = Terminated, non-payment, V = Vacation, W = Writeoff
ServiceInformation Services on the account. Returns service code and description. Ex: SW = Sewer, WA = Water

Sample Responses

Sample Code

using System.Net;
using Newtonsoft.Json.Linq;

public void MethodName(parms)
{
   string uri = "http://localhost/FusionServices/v2/Naviline/Utilities/Search/ByPhone";
   System.Collections.Specialized.NameValueCollection postParms = 
     new System.Collections.Specialized.NameValueCollection(); 
   // Set paramater values
   postParms.Add("areaCode",System.Web.HttpUtility.UrlEncode("407"));
   postParms.Add("phone",System.Web.HttpUtility.UrlEncode("3043235"));

   WebClient req = new WebClient();
   wc.Headers.Add("Content-Type", "application/x-www-form-urlencoded");
   wc.Headers.Set("X-APPID", "YOURID");
   wc.Headers.Set("X-APPKEY", "YOURKEY");

   byte[] responseBytes = wc.UploadValues(new Uri(uri), "POST", postParms);
   string stringResult = Encoding.UTF8.GetString(responseBytes); 
   JObject response = JObject.Parse(stringResult);
   string error = response["OutputParms"]["ErrorCode"].ToString();
   if (error == "0000")
   {
        JArray jRows = (JArray)response["Rows"];
        foreach (JObject row in jRows)
        {
             string Customer = row["Customer"].ToString();
             string Location = row["Location"].ToString();
             string LocationAddress = row["LocationAddress"].ToString();
             string CustomerName = row["CustomerName"].ToString();
             string DriverLicenseNumber = row["DriverLicenseNumber"].ToString();
             string SSN = row["SSN"].ToString();
             string AreaCode = row["AreaCode"].ToString();
             string PhoneNumber = row["PhoneNumber"].ToString();
             string Misc1Description = row["Misc1Description"].ToString();
             string Misc1Date = row["Misc1Date"].ToString();
             string Misc1Number = row["Misc1Number"].ToString();
             string Misc1UserDefined = row["Misc1UserDefined"].ToString();
             string Misc2Description = row["Misc2Description"].ToString();
             string Misc2Date = row["Misc2Date"].ToString();
             string Misc2Number = row["Misc2Number"].ToString();
             string Misc2UserDefined = row["Misc2UserDefined"].ToString();
             string Confidential = row["Confidential"].ToString();
             string CashOnly = row["CashOnly"].ToString();
             string Status = row["Status"].ToString();
             string ServiceInformation = row["ServiceInformation"].ToString();
             // TODO - YOUR CODE HERE
        }
   }
}

C# Razor MVC Sample Code

using System;
using System.Linq;
using System.Web;
using System.ComponentModel.DataAnnotations;
using System.Collections.Specialized;
using FusionServiceHelper.Models;

// NOTE: Use the namespace generated when you add the class, so that it is correct.
namespace FusionRazor.Models
{
   public class PostUtilitiesAccountSearchByPhone
   {
       // Add property for each input param in order to map a field to it
       [RegularExpression("[0-9]{0,3}", ErrorMessage = "Numeric values only. Must be 3 digits or less. ")]
       public string areaCode{get; set;}

       [RegularExpression("[0-9]{0,10}", ErrorMessage = "Numeric values only. Must be 10 digits or less. ")]
       public string phone{get; set;}

       [RegularExpression("[0-9]{0,3}", ErrorMessage = "Numeric values only. Must be 3 digits or less. ")]
       public string rows{get; set;}

       [RegularExpression("^[YN]{0,1}$", ErrorMessage = "Must be Y or N.")]
       public string active{get; set;}

       public PostUtilitiesAccountSearchByPhone()
       {
           //Set any defaults here
       }
   }
}
@* NOTE: Use Add->View to add the View. *@
@* NOTE: Check the 'Create strongly-typed view checkbox, and select the PostUtilitiesAccountSearchByPhone class. *@
@* NOTE: Select Edit as the Scaffold template. *@
@* NOTE: Use the @model line that is generated at the top.  Replace the rest with the lines below.
@model FusionRazor.Models.PostUtilitiesAccountSearchByPhone

@{
   ViewBag.Title = "PostUtilitiesAccountSearchByPhone";
}

<h2>PostUtilitiesAccountSearchByPhone</h2>
@using (Html.BeginForm()) {
   @Html.AntiForgeryToken()
   @Html.ValidationSummary(true)
   <fieldset>
   <legend>PostUtilitiesAccountSearchByPhone</legend>
       <div class="editor-label">
           @Html.LabelFor(model => model.areaCode)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.areaCode)
           @Html.ValidationMessageFor(model => model.areaCode)
       </div>
       <div class="editor-label">
           @Html.LabelFor(model => model.phone)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.phone)
           @Html.ValidationMessageFor(model => model.phone)
       </div>
       <div class="editor-label">
           @Html.LabelFor(model => model.rows)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.rows)
           @Html.ValidationMessageFor(model => model.rows)
       </div>
       <div class="editor-label">
           @Html.LabelFor(model => model.active)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.active)
           @Html.ValidationMessageFor(model => model.active)
       </div>
       <p>
       <input type="submit" value="Submit"/>
       </p>
   </fieldset>

}

@section Scripts {
   @Scripts.Render("~/bundles/jqueryval")
}
using System;
using System.Collections.Specialized;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using FusionServiceHelper.Models;

// NOTE: Replace 'MyController' with the name of your controller.

// 
// GET: /MyController/PostUtilitiesAccountSearchByPhone
public ActionResult PostUtilitiesAccountSearchByPhone()
{
   // Create a new instance of the model to pick up any default values.
   PostUtilitiesAccountSearchByPhone model =  new PostUtilitiesAccountSearchByPhone();

   // pass model to set to default values
   // NOTE: Change 'MyFolderPath' to the path to the .cshtml file.
   return View("~/Views/MyFolderPath/PostUtilitiesAccountSearchByPhone.cshtml", model);
}

// 
// POST: /MyController/PostUtilitiesAccountSearchByPhone
[HttpPost]
public ActionResult PostUtilitiesAccountSearchByPhone(FormCollection collection)
{
   string url = "v2/Naviline/Utilities/Search/ByPhone";
   // Get the value from each input field
   NameValueCollection inputParms = new NameValueCollection();
   inputParms.Add("areaCode", collection["areaCode"]);
   inputParms.Add("phone", collection["phone"]);
   inputParms.Add("rows", collection["rows"]);
   inputParms.Add("active", collection["active"]);

   try
   {
       // Send the request
       FusionServiceRequest request = new FusionServiceRequest();
       FusionServiceResult result = request.Post(url, inputParms);

       return View("Result", result);
   }
   catch(Exception e)
   {
       HandleErrorInfo info = new HandleErrorInfo(e, "MyController", "PostUtilitiesAccountSearchByPhone");
       return View("Error", info);
   }
}