Method PostCreateInspection

Summary

Create Inspection

Remarks

Schedule an inspection

Common uses:

Input Parameters

NameTypeLengthDescription
permitIVR numeric 9 [Required] Permit IVR Number. See GetValidateApplication
inspectionTypeIVR numeric 5 [Required] Inspection Type IVR Number. See GetRequiredInspections
requiredDate numeric 6 [Required] Inspection Date. See GetValidInspectionDates
timeOption numeric 1 1=AM 2=PM Blank = no preference
inspectorID System.String 6 [Required] Inspector's ID. Use this to override the inspector assigned by location. See GetValidInspectionDates
messageID System.String 1 Y/N

Example

POST http://localhost/FusionServices/v2/Naviline/IVR/CreateInspection/

Return Values

NameDescription
InspectionIVR Inspection IVR number
ErrorCode Blank if successful

Sample Responses

Sample Code

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

public void MethodName(parms)
{
   string uri = "http://localhost/FusionServices/v2/Naviline/IVR/CreateInspection/";
   System.Collections.Specialized.NameValueCollection postParms = 
     new System.Collections.Specialized.NameValueCollection(); 
   // Set paramater values
   postParms.Add("permitIVR",System.Web.HttpUtility.UrlEncode("000193698"));
   postParms.Add("inspectionTypeIVR",System.Web.HttpUtility.UrlEncode("00005"));
   postParms.Add("requiredDate",System.Web.HttpUtility.UrlEncode("170419"));
   postParms.Add("inspectorID",System.Web.HttpUtility.UrlEncode("AR"));

   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 PostCreateInspection
   {
       // 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 permitIVR{get; set;}

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

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

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

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

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

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

@{
   ViewBag.Title = "PostCreateInspection";
}

<h2>PostCreateInspection</h2>
@using (Html.BeginForm()) {
   @Html.AntiForgeryToken()
   @Html.ValidationSummary(true)
   <fieldset>
   <legend>PostCreateInspection</legend>
       <div class="editor-label">
           @Html.LabelFor(model => model.permitIVR)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.permitIVR)
           @Html.ValidationMessageFor(model => model.permitIVR)
       </div>
       <div class="editor-label">
           @Html.LabelFor(model => model.inspectionTypeIVR)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.inspectionTypeIVR)
           @Html.ValidationMessageFor(model => model.inspectionTypeIVR)
       </div>
       <div class="editor-label">
           @Html.LabelFor(model => model.requiredDate)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.requiredDate)
           @Html.ValidationMessageFor(model => model.requiredDate)
       </div>
       <div class="editor-label">
           @Html.LabelFor(model => model.timeOption)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.timeOption)
           @Html.ValidationMessageFor(model => model.timeOption)
       </div>
       <div class="editor-label">
           @Html.LabelFor(model => model.inspectorID)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.inspectorID)
           @Html.ValidationMessageFor(model => model.inspectorID)
       </div>
       <div class="editor-label">
           @Html.LabelFor(model => model.messageID)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.messageID)
           @Html.ValidationMessageFor(model => model.messageID)
       </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/PostCreateInspection
public ActionResult PostCreateInspection()
{
   // Create a new instance of the model to pick up any default values.
   PostCreateInspection model =  new PostCreateInspection();

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

// 
// POST: /MyController/PostCreateInspection
[HttpPost]
public ActionResult PostCreateInspection(FormCollection collection)
{
   string url = "v2/Naviline/IVR/CreateInspection/";
   // Get the value from each input field
   NameValueCollection inputParms = new NameValueCollection();
   inputParms.Add("permitIVR", collection["permitIVR"]);
   inputParms.Add("inspectionTypeIVR", collection["inspectionTypeIVR"]);
   inputParms.Add("requiredDate", collection["requiredDate"]);
   inputParms.Add("timeOption", collection["timeOption"]);
   inputParms.Add("inspectorID", collection["inspectorID"]);
   inputParms.Add("messageID", collection["messageID"]);

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