Method PostComponentInfo

Summary

Component Information

Remarks

CX Inquire Component Service, retrieving Customer ID and Name, Location ID and Service Address and Component Service Information based Location/Service/Flat Rate Code and Component Sequence. Allows you to Add an addition Component by Location/ Location/Service/Flat Rate Code and Allows you to update an existing components quantity by Location/Service/Flat Rate Code and Component Sequence.

Requires

Input Parameters

NameTypeLengthDescription
locationId numeric 9 [Required] 9 digit Location ID
serviceCode char 2 [Required] 2 digit service code
flatRateCode char 4 [Required] 4 digit flat rate code
mode char 1 [Required] "I" for inquiry, "A" for add, "U" for update
sequence numeric 3 3 digit sequence number, Required for Add
quantity numeric 9 Quantity, Required for Add and Update, assume 4 decimal positions
termYear numeric 2 Termination Year
termMonth numeric 2 Termination Month
termDay numeric 2 Termination Day
startYear numeric 2 Start Year, Required for Add
startMonth numeric 2 Start Month, Required for Add
startDay numeric 2 Start Day, Required for Add

Example

POST http://localhost/FusionServices/v3/Naviline/Utilities/ComponentInfo

Return Values

NameDescription
ErrorCode 0000=Success
ErrorMessage Description of error if any
Quantity 000010000
TerminationYear 00
TerminationMonth 00
TerminationDay 00
StartYear 20
StartMonth 09
StartDay 05
Status A
Comment
USER Fusion
StartCentury 1
StopCentury 0
ServiceAddress 2009 N TIMBERLAND DR
ServiceZip 75904
ServiceCity LUFKIN
ServiceState TX
CustomerI 000010887
CustomerName HUMPHREYS, GLENN R
CustomerNameType P

Sample Responses

Sample Code

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

public void MethodName(parms)
{
   string uri = "http://localhost/FusionServices/v3/Naviline/Utilities/ComponentInfo";
   System.Collections.Specialized.NameValueCollection postParms = 
     new System.Collections.Specialized.NameValueCollection(); 
   // Set paramater values
   postParms.Add("locationId",System.Web.HttpUtility.UrlEncode("000036678"));
   postParms.Add("serviceCode",System.Web.HttpUtility.UrlEncode("SA"));
   postParms.Add("flatRateCode",System.Web.HttpUtility.UrlEncode("3ADD"));
   postParms.Add("sequence",System.Web.HttpUtility.UrlEncode("003"));
   postParms.Add("mode",System.Web.HttpUtility.UrlEncode("I"));

   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")
   {
         // 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 PostComponentInfo
   {
       // Add property for each input param in order to map a field to it
       [Required(ErrorMessage = "Required")]
       [RegularExpression("[0-9]{0,9}", ErrorMessage = "Numeric values only. Must be 9 digits or less. ")]
       public string locationId{get; set;}

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

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

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

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

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

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

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

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

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

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

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

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

@{
   ViewBag.Title = "PostComponentInfo";
}

<h2>PostComponentInfo</h2>
@using (Html.BeginForm()) {
   @Html.AntiForgeryToken()
   @Html.ValidationSummary(true)
   <fieldset>
   <legend>PostComponentInfo</legend>
       <div class="editor-label">
           @Html.LabelFor(model => model.locationId)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.locationId)
           @Html.ValidationMessageFor(model => model.locationId)
       </div>
       <div class="editor-label">
           @Html.LabelFor(model => model.serviceCode)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.serviceCode)
           @Html.ValidationMessageFor(model => model.serviceCode)
       </div>
       <div class="editor-label">
           @Html.LabelFor(model => model.flatRateCode)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.flatRateCode)
           @Html.ValidationMessageFor(model => model.flatRateCode)
       </div>
       <div class="editor-label">
           @Html.LabelFor(model => model.mode)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.mode)
           @Html.ValidationMessageFor(model => model.mode)
       </div>
       <div class="editor-label">
           @Html.LabelFor(model => model.sequence)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.sequence)
           @Html.ValidationMessageFor(model => model.sequence)
       </div>
       <div class="editor-label">
           @Html.LabelFor(model => model.quantity)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.quantity)
           @Html.ValidationMessageFor(model => model.quantity)
       </div>
       <div class="editor-label">
           @Html.LabelFor(model => model.termYear)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.termYear)
           @Html.ValidationMessageFor(model => model.termYear)
       </div>
       <div class="editor-label">
           @Html.LabelFor(model => model.termMonth)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.termMonth)
           @Html.ValidationMessageFor(model => model.termMonth)
       </div>
       <div class="editor-label">
           @Html.LabelFor(model => model.termDay)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.termDay)
           @Html.ValidationMessageFor(model => model.termDay)
       </div>
       <div class="editor-label">
           @Html.LabelFor(model => model.startYear)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.startYear)
           @Html.ValidationMessageFor(model => model.startYear)
       </div>
       <div class="editor-label">
           @Html.LabelFor(model => model.startMonth)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.startMonth)
           @Html.ValidationMessageFor(model => model.startMonth)
       </div>
       <div class="editor-label">
           @Html.LabelFor(model => model.startDay)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.startDay)
           @Html.ValidationMessageFor(model => model.startDay)
       </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/PostComponentInfo
public ActionResult PostComponentInfo()
{
   // Create a new instance of the model to pick up any default values.
   PostComponentInfo model =  new PostComponentInfo();

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

// 
// POST: /MyController/PostComponentInfo
[HttpPost]
public ActionResult PostComponentInfo(FormCollection collection)
{
   string url = "v3/Naviline/Utilities/ComponentInfo";
   // Get the value from each input field
   NameValueCollection inputParms = new NameValueCollection();
   inputParms.Add("locationId", collection["locationId"]);
   inputParms.Add("serviceCode", collection["serviceCode"]);
   inputParms.Add("flatRateCode", collection["flatRateCode"]);
   inputParms.Add("mode", collection["mode"]);
   inputParms.Add("sequence", collection["sequence"]);
   inputParms.Add("quantity", collection["quantity"]);
   inputParms.Add("termYear", collection["termYear"]);
   inputParms.Add("termMonth", collection["termMonth"]);
   inputParms.Add("termDay", collection["termDay"]);
   inputParms.Add("startYear", collection["startYear"]);
   inputParms.Add("startMonth", collection["startMonth"]);
   inputParms.Add("startDay", collection["startDay"]);

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