Method PostSearchBusinessByAddress

Summary

Search Business by Address

Remarks

Search for streets beginning with this name. For paging, send the FirstBizControl, FirstLocID, LastBizControl and LastLocID from previous search. And set Pager to N=Next, P=Prev.

Input Parameters

NameTypeLengthDescription
StreetName System.String 25 [Required] Street name
StreetNumber numeric 7 Street number
StreetDirection System.String 2 Street direction. Ex. N, NW, S, SW, E, W
StreetSuffix System.String 4 Street suffix. Ex. St, Ln, Ave
Apartment System.String 5 Apartment number
ZipCode System.String 9 Zip code
rows numeric 4 Number of rows to return. Defaults to 8 rows.
FirstBizControl numeric 7 Biz Control of first record returned from previous search. Used with paging.
FirstLocID numeric 9 Location ID of first record returned from previous search. Used with paging.
LastBizControl numeric 7 Biz Control of last record returned from previous search. Used with paging.
LastLocID numeric 9 Location ID of last record returned from previous search. Used with paging.
Pager System.String 1 Paging flag. 1=New Search, N=Next rows, P=Prev rows. Defaults to 1=NewSearch

Example

POST http://localhost/FusionServices/v2/Naviline/OccupationalLicense/SearchBusinessByAddress

Return Values

NameDescription
ErrorCode 0000=Success
ErrorMessage Message returned with error code
ControlNumber Business Control number
LocationNumber Location number for business
Name Business name
Address Business Address
CityStateZip Business City, ST Zip line
MailingAddressLine1 Mailing Address line 1
MailingAddressLine2 Mailing Address line 2
MailingCityStateZip Mailing City, ST Zip line
MailingDeliveryPoint Mailing City, ST Zip line
MainAreaCode Area Code on main phone number
MainPhoneNumber Main phone number
BusinessStatusCode Status code
BusinessStatusDescription Status description
OpenDate Date business was opened
ContractorFlag Contractor Y/N
OwnershipTypeCode Ownership Type code
OwnershipTypeDescription Ownership Type description
FedTaxID Federal Tax ID
OWNER Owner name
InternetUseFlag Available for online use
MOREYN More Rows Y/N
ROWS Row count returned
FirstBizControl First Business control number found
FirstLocID First Location ID found
LastBizControl Last Business control number found
LastLocID Last Location ID found

Sample Responses

Sample Code

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

public void MethodName(parms)
{
   string uri = "http://localhost/FusionServices/v2/Naviline/OccupationalLicense/SearchBusinessByAddress";
   System.Collections.Specialized.NameValueCollection postParms = 
     new System.Collections.Specialized.NameValueCollection(); 
   // Set paramater values
   postParms.Add("StreetName",System.Web.HttpUtility.UrlEncode("Sunlight"));
   postParms.Add("StreetNumber",System.Web.HttpUtility.UrlEncode("225"));
   postParms.Add("StreetSuffix",System.Web.HttpUtility.UrlEncode("Ln"));
   postParms.Add("StreetDirection",System.Web.HttpUtility.UrlEncode(""));

   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 ControlNumber = row["ControlNumber"].ToString();
             string LocationNumber = row["LocationNumber"].ToString();
             string Name = row["Name"].ToString();
             string Address = row["Address"].ToString();
             string CityStateZip = row["CityStateZip"].ToString();
             string MailingAddressLine1 = row["MailingAddressLine1"].ToString();
             string MailingAddressLine2 = row["MailingAddressLine2"].ToString();
             string MailingCityStateZip = row["MailingCityStateZip"].ToString();
             string MailingDeliveryPoint = row["MailingDeliveryPoint"].ToString();
             string MainAreaCode = row["MainAreaCode"].ToString();
             string MainPhoneNumber = row["MainPhoneNumber"].ToString();
             string BusinessStatusCode = row["BusinessStatusCode"].ToString();
             string BusinessStatusDescription = row["BusinessStatusDescription"].ToString();
             string OpenDate = row["OpenDate"].ToString();
             string ContractorFlag = row["ContractorFlag"].ToString();
             string OwnershipTypeCode = row["OwnershipTypeCode"].ToString();
             string OwnershipTypeDescription = row["OwnershipTypeDescription"].ToString();
             string FedTaxID = row["FedTaxID"].ToString();
             string OWNER = row["OWNER"].ToString();
             string InternetUseFlag = row["InternetUseFlag"].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 PostSearchBusinessByAddress
   {
       // 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 StreetDirection{get; set;}

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

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

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

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

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

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

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

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

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

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

@{
   ViewBag.Title = "PostSearchBusinessByAddress";
}

<h2>PostSearchBusinessByAddress</h2>
@using (Html.BeginForm()) {
   @Html.AntiForgeryToken()
   @Html.ValidationSummary(true)
   <fieldset>
   <legend>PostSearchBusinessByAddress</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.StreetDirection)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.StreetDirection)
           @Html.ValidationMessageFor(model => model.StreetDirection)
       </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.Apartment)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.Apartment)
           @Html.ValidationMessageFor(model => model.Apartment)
       </div>
       <div class="editor-label">
           @Html.LabelFor(model => model.ZipCode)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.ZipCode)
           @Html.ValidationMessageFor(model => model.ZipCode)
       </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.FirstBizControl)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.FirstBizControl)
           @Html.ValidationMessageFor(model => model.FirstBizControl)
       </div>
       <div class="editor-label">
           @Html.LabelFor(model => model.FirstLocID)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.FirstLocID)
           @Html.ValidationMessageFor(model => model.FirstLocID)
       </div>
       <div class="editor-label">
           @Html.LabelFor(model => model.LastBizControl)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.LastBizControl)
           @Html.ValidationMessageFor(model => model.LastBizControl)
       </div>
       <div class="editor-label">
           @Html.LabelFor(model => model.LastLocID)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.LastLocID)
           @Html.ValidationMessageFor(model => model.LastLocID)
       </div>
       <div class="editor-label">
           @Html.LabelFor(model => model.Pager)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.Pager)
           @Html.ValidationMessageFor(model => model.Pager)
       </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/PostSearchBusinessByAddress
public ActionResult PostSearchBusinessByAddress()
{
   // Create a new instance of the model to pick up any default values.
   PostSearchBusinessByAddress model =  new PostSearchBusinessByAddress();

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

// 
// POST: /MyController/PostSearchBusinessByAddress
[HttpPost]
public ActionResult PostSearchBusinessByAddress(FormCollection collection)
{
   string url = "v2/Naviline/OccupationalLicense/SearchBusinessByAddress";
   // Get the value from each input field
   NameValueCollection inputParms = new NameValueCollection();
   inputParms.Add("StreetName", collection["StreetName"]);
   inputParms.Add("StreetNumber", collection["StreetNumber"]);
   inputParms.Add("StreetDirection", collection["StreetDirection"]);
   inputParms.Add("StreetSuffix", collection["StreetSuffix"]);
   inputParms.Add("Apartment", collection["Apartment"]);
   inputParms.Add("ZipCode", collection["ZipCode"]);
   inputParms.Add("rows", collection["rows"]);
   inputParms.Add("FirstBizControl", collection["FirstBizControl"]);
   inputParms.Add("FirstLocID", collection["FirstLocID"]);
   inputParms.Add("LastBizControl", collection["LastBizControl"]);
   inputParms.Add("LastLocID", collection["LastLocID"]);
   inputParms.Add("Pager", collection["Pager"]);

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