Upload Voided Check
Accepted file types: JPG, JPEG, PNG, TIF, TIFF, PDF. Maximum file size: 16 MB.
| Name | Type | Length | Description |
|---|---|---|---|
| customerNumber | System.String | 9 | [Required] Customer Number (numeric, zero-padded to 9 digits). See Account Search methods. |
| locationNumber | System.String | 9 | [Required] Location Number (numeric, zero-padded to 9 digits). See Account Search methods. |
| fileType | System.String | 5 | [Required] File type of the uploaded image. Ex. JPG, PNG, PDF, TIFF. |
| file | System.String | 16000000 | [Required] File that you want to upload. You could send it via form-data or binary |
POST http://localhost/FusionServices/v3/Naviline/Utilities/UploadVoidedCheck/000027211/000009258/JPG
| Name | Description |
|---|---|
| ErrorCode | 0000 |
| ErrorMessage |
using System.Net;
using System.Text;
string uri = "http://localhost/FusionServices/v3/Naviline/Utilities/UploadVoidedCheck/000027211/000009258/JPG";
using (WebClient req = new WebClient())
{
req.Headers.Set("X-APPID", "YOURID");
req.Headers.Set("X-APPKEY", "YOURKEY");
byte[] responseBytes = req.UploadFile(uri, "C:\\Temp\\voidedcheck.jpg");
string stringResult = Encoding.UTF8.GetString(responseBytes);
// 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 PostUploadVoidedCheck
{
// 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 customerNumber{get; set;}
[Required(ErrorMessage = "Required")]
[RegularExpression("^(?=.{0,9}$).*", ErrorMessage = "Must be 9 characters or less. ")]
public string locationNumber{get; set;}
[Required(ErrorMessage = "Required")]
[RegularExpression("^(?=.{0,5}$).*", ErrorMessage = "Must be 5 characters or less. ")]
public string fileType{get; set;}
[Required(ErrorMessage = "Required")]
[RegularExpression("^(?=.{0,16000000}$).*", ErrorMessage = "Must be 16000000 characters or less. ")]
public string file{get; set;}
public PostUploadVoidedCheck()
{
//Set any defaults here
}
}
}
@* NOTE: Use Add->View to add the View. *@
@* NOTE: Check the 'Create strongly-typed view checkbox, and select the PostUploadVoidedCheck 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.PostUploadVoidedCheck
@{
ViewBag.Title = "PostUploadVoidedCheck";
}
<h2>PostUploadVoidedCheck</h2>
@using (Html.BeginForm()) {
@Html.AntiForgeryToken()
@Html.ValidationSummary(true)
<fieldset>
<legend>PostUploadVoidedCheck</legend>
<div class="editor-label">
@Html.LabelFor(model => model.customerNumber)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.customerNumber)
@Html.ValidationMessageFor(model => model.customerNumber)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.locationNumber)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.locationNumber)
@Html.ValidationMessageFor(model => model.locationNumber)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.fileType)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.fileType)
@Html.ValidationMessageFor(model => model.fileType)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.file)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.file)
@Html.ValidationMessageFor(model => model.file)
</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/PostUploadVoidedCheck
public ActionResult PostUploadVoidedCheck()
{
// Create a new instance of the model to pick up any default values.
PostUploadVoidedCheck model = new PostUploadVoidedCheck();
// pass model to set to default values
// NOTE: Change 'MyFolderPath' to the path to the .cshtml file.
return View("~/Views/MyFolderPath/PostUploadVoidedCheck.cshtml", model);
}
//
// POST: /MyController/PostUploadVoidedCheck
[HttpPost]
public ActionResult PostUploadVoidedCheck(FormCollection collection)
{
string url = "v3/Naviline/Utilities/UploadVoidedCheck/000027211/000009258/JPG";
// Get the value from each input field
NameValueCollection inputParms = new NameValueCollection();
inputParms.Add("customerNumber", collection["customerNumber"]);
inputParms.Add("locationNumber", collection["locationNumber"]);
inputParms.Add("fileType", collection["fileType"]);
inputParms.Add("file", collection["file"]);
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", "PostUploadVoidedCheck");
return View("Error", info);
}
}