Method PostUtilitiesAccountSearchByAddress

Summary

Search for a utility account by address

Remarks

This service searches for a utility account by street address. The customer will have to enter a street name, or part of a street name to search on and the service will return a list of possible account matches for the customer to select their account from. Once selected, you will have the customer and location number that is required for calling the other utility services. This returns matching names for both residential and commercial customers.

Input Parameters

NameTypeLengthDescription
streetName System.String 25 [Required] Street name to search on
streetNumber numeric 7 House or building number to search on
streetDir System.String 2 Street direction. Ex. N, S, E, W, NE, NW, etc.
streetSuffix System.String 4 Street suffix code Ex. AVE=Avenue, BLVD=Boulevard, CIR=Circle, CT=Court, DR=Drive, LN=Lane
showConf yn 0 Y/N Show confidential records - defaults to N

Example

POST http://localhost/FusionServices/v2/NaviLine/Utilities/Search/Account/ByAddress

Returns

This returns account info for both residential and commercial customers that match the street name. It returns the customer number and location number which together make up the account number used by most other services to identify the customer’s account. It also returns additional information, such as the customer's name, so the customer can select which account is theirs in case multiple accounts match the street address.

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.
Address Customer’s street address
Name The customer’s name. For residential accounts, it should be in the format LAST, FIRST. For commercial accounts, it will be the business name.
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
ErrorCode 0000=Success 0003=Success, but more records found

Sample Responses

Sample Code

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

public void MethodName(parms)
{
   string uri = "http://localhost/FusionServices/v2/Naviline/Utilities/Search/Account/ByAddress";
   System.Collections.Specialized.NameValueCollection postParms = 
     new System.Collections.Specialized.NameValueCollection(); 
   // Set paramater values
   postParms.Add("streetName",System.Web.HttpUtility.UrlEncode("FRANK"));
   postParms.Add("streetNumber",System.Web.HttpUtility.UrlEncode("236"));

   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") || (error == "0003"))
   {
        JArray jRows = (JArray)response["Rows"];
        foreach (JObject row in jRows)
        {
             string Customer = row["Customer"].ToString();
             string Location = row["Location"].ToString();
             string Address = row["Address"].ToString();
             string Name = row["Name"].ToString();
             string Confidential = row["Confidential"].ToString();
             string CashOnly = row["CashOnly"].ToString();
             string Status = row["Status"].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 PostUtilitiesAccountSearchByAddress
   {
       // Add property for each input param in order to map a field to it
       [Required(ErrorMessage = "Required")]
       [RegularExpression("^(?=.{0,25}$).*", ErrorMessage = "Must be 25 characters or less. ")]
       public string streetName{get; set;}

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

       [RegularExpression("^(?=.{0,2}$).*", ErrorMessage = "Must be 2 characters or less. ")]
       public string streetDir{get; set;}

       [RegularExpression("^(?=.{0,4}$).*", ErrorMessage = "Must be 4 characters or less. ")]
       public string streetSuffix{get; set;}

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

       public PostUtilitiesAccountSearchByAddress()
       {
           //Set any defaults here
       }
   }
}
@* NOTE: Use Add->View to add the View. *@
@* NOTE: Check the 'Create strongly-typed view checkbox, and select the PostUtilitiesAccountSearchByAddress 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.PostUtilitiesAccountSearchByAddress

@{
   ViewBag.Title = "PostUtilitiesAccountSearchByAddress";
}

<h2>PostUtilitiesAccountSearchByAddress</h2>
@using (Html.BeginForm()) {
   @Html.AntiForgeryToken()
   @Html.ValidationSummary(true)
   <fieldset>
   <legend>PostUtilitiesAccountSearchByAddress</legend>
       <div class="editor-label">
           @Html.LabelFor(model => model.streetName)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.streetName)
           @Html.ValidationMessageFor(model => model.streetName)
       </div>
       <div class="editor-label">
           @Html.LabelFor(model => model.streetNumber)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.streetNumber)
           @Html.ValidationMessageFor(model => model.streetNumber)
       </div>
       <div class="editor-label">
           @Html.LabelFor(model => model.streetDir)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.streetDir)
           @Html.ValidationMessageFor(model => model.streetDir)
       </div>
       <div class="editor-label">
           @Html.LabelFor(model => model.streetSuffix)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.streetSuffix)
           @Html.ValidationMessageFor(model => model.streetSuffix)
       </div>
       <div class="editor-label">
           @Html.LabelFor(model => model.showConf)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.showConf)
           @Html.ValidationMessageFor(model => model.showConf)
       </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/PostUtilitiesAccountSearchByAddress
public ActionResult PostUtilitiesAccountSearchByAddress()
{
   // Create a new instance of the model to pick up any default values.
   PostUtilitiesAccountSearchByAddress model =  new PostUtilitiesAccountSearchByAddress();

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

// 
// POST: /MyController/PostUtilitiesAccountSearchByAddress
[HttpPost]
public ActionResult PostUtilitiesAccountSearchByAddress(FormCollection collection)
{
   string url = "v2/NaviLine/Utilities/Search/Account/ByAddress";
   // Get the value from each input field
   NameValueCollection inputParms = new NameValueCollection();
   inputParms.Add("streetName", collection["streetName"]);
   inputParms.Add("streetNumber", collection["streetNumber"]);
   inputParms.Add("streetDir", collection["streetDir"]);
   inputParms.Add("streetSuffix", collection["streetSuffix"]);
   inputParms.Add("showConf", collection["showConf"]);

   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", "PostUtilitiesAccountSearchByAddress");
       return View("Error", info);
   }
}