Method PostSearchBusinessByPhone

Summary

Search Business by Phone

Remarks

Search by phone number. For paging, send the FirstBizControl, FirstLocID, LastBizControl and LastLocID from previous search. And set Pager to N=Next, P=Prev.

Input Parameters

NameTypeLengthDescription
phone System.String 10 [Required] Phone number including area code. Numeric only, no dashes. Ex. For 111-222-3333 enter 1112223333
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/SearchBusinessByPhone

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/SearchBusinessByPhone";
   System.Collections.Specialized.NameValueCollection postParms = 
     new System.Collections.Specialized.NameValueCollection(); 
   // Set paramater values
   postParms.Add("phone",System.Web.HttpUtility.UrlEncode("4078874441"));

   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 PostSearchBusinessByPhone
   {
       // Add property for each input param in order to map a field to it
       [Required(ErrorMessage = "Required")]
       [RegularExpression("^(?=.{0,10}$).*", ErrorMessage = "Must be 10 characters or less. ")]
       public string phone{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 PostSearchBusinessByPhone()
       {
           //Set any defaults here
       }
   }
}
@* NOTE: Use Add->View to add the View. *@
@* NOTE: Check the 'Create strongly-typed view checkbox, and select the PostSearchBusinessByPhone 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.PostSearchBusinessByPhone

@{
   ViewBag.Title = "PostSearchBusinessByPhone";
}

<h2>PostSearchBusinessByPhone</h2>
@using (Html.BeginForm()) {
   @Html.AntiForgeryToken()
   @Html.ValidationSummary(true)
   <fieldset>
   <legend>PostSearchBusinessByPhone</legend>
       <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.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/PostSearchBusinessByPhone
public ActionResult PostSearchBusinessByPhone()
{
   // Create a new instance of the model to pick up any default values.
   PostSearchBusinessByPhone model =  new PostSearchBusinessByPhone();

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

// 
// POST: /MyController/PostSearchBusinessByPhone
[HttpPost]
public ActionResult PostSearchBusinessByPhone(FormCollection collection)
{
   string url = "v2/Naviline/OccupationalLicense/SearchBusinessByPhone";
   // Get the value from each input field
   NameValueCollection inputParms = new NameValueCollection();
   inputParms.Add("phone", collection["phone"]);
   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", "PostSearchBusinessByPhone");
       return View("Error", info);
   }
}