Returns usage history of utility service consumption per billing cycle
This method retrieves usage information as recorded from a given meter assigned to the customer. If a customer has more than one meter, you would have to call this method for each meter separately to retrieve all the usage history for the utility service. You would also have to call this method separately for each type of utility service, such as water or electricity.
It returns the following information:
Name | Type | Length | Description |
---|---|---|---|
customerNumber | numeric | 9 | [Required] Customer Number. See Account Search methods. |
locationNumber | numeric | 9 | [Required] Location Number. See Account Search methods. |
ServiceCode | System.String | 2 | [Required] Service Code. Use the ServiceCode field returned by GetCurrentCharges |
Sequence | numeric | 3 | [Required] 3 digit sequence, starting at 000 indentifying the meter. See the Sequence field returned by the GetMeterDetail method. |
GET http://localhost/FusionServices/v2/Naviline/Utilities/{CustomerNumber}/{LocationNumber}/service/{ServiceCode}/meter/consumption/{Sequence}
Name | Description |
---|---|
Service | Two letter code indicating the type of utility service. Example: WA for water |
Sequence | The three digit sequence number assigned to the meter. This is the order in which the meter reader reads the meter within her route. This is used to identify the meter internally. |
BillingPeriod | Date of the (monthly) billing period the meter read was taken. Format: MMYYYY |
DaysInBillingPeriod | Number of days in the billing period |
DailyPeriodUsage | Calculated daily usage during the billing period. |
TotalPeriodUsage | Total usage during the billing period. |
DemandDailyPeriodUsage | Calculated daily overage demand used during the billing period. |
DemandTotalPeriodUsage | Total overage demand usage during the billing period. Demand is the amount of usage over a set limit that may occur additional charges or a higher billing rate. |
using System.Net;
using Newtonsoft.Json.Linq;
public void MethodName(parms)
{
string uri = "http://localhost/FusionServices/v2/Naviline/Utilities/27211/9258/service/IR/meter/consumption/000";
WebClient wc = new WebClient();
wc.Headers.Set("X-APPID", "YOURID");
wc.Headers.Set("X-APPKEY", "YOURKEY");
string stringResult = wc.DownloadString(new Uri(uri));
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 Service = row["Service"].ToString();
string Sequence = row["Sequence"].ToString();
string BillingPeriod = row["BillingPeriod"].ToString();
string DaysInBillingPeriod = row["DaysInBillingPeriod"].ToString();
string DailyPeriodUsage = row["DailyPeriodUsage"].ToString();
string TotalPeriodUsage = row["TotalPeriodUsage"].ToString();
string DemandDailyPeriodUsage = row["DemandDailyPeriodUsage"].ToString();
string DemandTotalPeriodUsage = row["DemandTotalPeriodUsage"].ToString();
// TODO - YOUR CODE HERE
}
}
}
$.get('http://localhost/FusionServices/v2/Naviline/Utilities/27211/9258/service/IR/meter/consumption/000', function(response) {
$('#resultDiv).html(response);
});
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 GetConsumptionHistory
{
// 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 customerNumber{get; set;}
[Required(ErrorMessage = "Required")]
[RegularExpression("[0-9]{0,9}", ErrorMessage = "Numeric values only. Must be 9 digits or less. ")]
public string locationNumber{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-9]{0,3}", ErrorMessage = "Numeric values only. Must be 3 digits or less. ")]
public string Sequence{get; set;}
public GetConsumptionHistory()
{
//Set any defaults here
customerNumber = DefaultData.Get("customerNumber");
locationNumber = DefaultData.Get("locationNumber");
ServiceCode = DefaultData.Get("ServiceCode");
Sequence = DefaultData.Get("Sequence");
}
}
}
@* NOTE: Use Add->View to add the View. *@
@* NOTE: Check the 'Create strongly-typed view checkbox, and select the GetConsumptionHistory 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.GetConsumptionHistory
@{
ViewBag.Title = "GetConsumptionHistory";
string myUrl = "http://localhost/FusionServices/v2/Naviline/Utilities/" + Model.CustomerNumber + "/" + Model.LocationNumber + "/service/" + Model.ServiceCode + "/meter/consumption/" + Model.Sequence;
}
<h2>GetConsumptionHistory</h2>
@using (Html.BeginForm()) {
@Html.AntiForgeryToken()
@Html.ValidationSummary(true)
<fieldset>
<legend>GetConsumptionHistory</legend>
<div class="editor-label">Use the fields below to change the values and resubmit.</div>
<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.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.Sequence)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.Sequence)
@Html.ValidationMessageFor(model => model.Sequence)
</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/GetConsumptionHistory
public ActionResult GetConsumptionHistory()
{
// Create a new instance of the model to pick up any default values.
GetConsumptionHistory model = new GetConsumptionHistory();
// pass model to set to default values
// NOTE: Change 'MyFolderPath' to the path to the .cshtml file.
return View("~/Views/MyFolderPath/GetConsumptionHistory.cshtml", model);
}
//
// POST: /MyController/GetConsumptionHistory
[HttpPost]
public ActionResult GetConsumptionHistory(FormCollection collection)
{
string url = "v2/Naviline/Utilities/{CustomerNumber}/{LocationNumber}/service/{ServiceCode}/meter/consumption/{Sequence}";
// Get the value from each input field
NameValueCollection inputParms = new NameValueCollection();
inputParms.Add("customerNumber", collection["customerNumber"]);
inputParms.Add("locationNumber", collection["locationNumber"]);
inputParms.Add("ServiceCode", collection["ServiceCode"]);
inputParms.Add("Sequence", collection["Sequence"]);
try
{
// Send the request
FusionServiceRequest request = new FusionServiceRequest();
FusionServiceResult result = request.Get(url, inputParms);
return View("Result", result);
}
catch(Exception e)
{
HandleErrorInfo info = new HandleErrorInfo(e, "MyController", "GetConsumptionHistory");
return View("Error", info);
}
}