Search Business by Zip Code
Name | Type | Length | Description |
---|---|---|---|
ZipCode | System.String | 9 | [Required] Zip code |
rows | numeric | 4 | Number of rows to return |
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 |
POST http://localhost/FusionServices/v2/Naviline/OccupationalLicense/SearchBusinessByZipCode
Name | Description |
---|---|
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 |
using System.Net;
using Newtonsoft.Json.Linq;
public void MethodName(parms)
{
string uri = "http://localhost/FusionServices/v2/Naviline/OccupationalLicense/SearchBusinessByZipCode";
System.Collections.Specialized.NameValueCollection postParms =
new System.Collections.Specialized.NameValueCollection();
// Set paramater values
postParms.Add("ZipCode",System.Web.HttpUtility.UrlEncode("75901"));
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
}
}
}
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 PostSearchBusinessByZipCode
{
// Add property for each input param in order to map a field to it
[Required(ErrorMessage = "Required")]
[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 PostSearchBusinessByZipCode()
{
//Set any defaults here
}
}
}
@* NOTE: Use Add->View to add the View. *@
@* NOTE: Check the 'Create strongly-typed view checkbox, and select the PostSearchBusinessByZipCode 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.PostSearchBusinessByZipCode
@{
ViewBag.Title = "PostSearchBusinessByZipCode";
}
<h2>PostSearchBusinessByZipCode</h2>
@using (Html.BeginForm()) {
@Html.AntiForgeryToken()
@Html.ValidationSummary(true)
<fieldset>
<legend>PostSearchBusinessByZipCode</legend>
<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/PostSearchBusinessByZipCode
public ActionResult PostSearchBusinessByZipCode()
{
// Create a new instance of the model to pick up any default values.
PostSearchBusinessByZipCode model = new PostSearchBusinessByZipCode();
// pass model to set to default values
// NOTE: Change 'MyFolderPath' to the path to the .cshtml file.
return View("~/Views/MyFolderPath/PostSearchBusinessByZipCode.cshtml", model);
}
//
// POST: /MyController/PostSearchBusinessByZipCode
[HttpPost]
public ActionResult PostSearchBusinessByZipCode(FormCollection collection)
{
string url = "v2/Naviline/OccupationalLicense/SearchBusinessByZipCode";
// Get the value from each input field
NameValueCollection inputParms = new NameValueCollection();
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", "PostSearchBusinessByZipCode");
return View("Error", info);
}
}