Account Profile Query
URL Endpoint: https://easypay5.com/APIcardProcREST/v1.0.0/Query/AccountProfile
Request Method: POST
Headers:
Session Key is passed to the API via the header:
Content-Type: application/json
Accept: application/json
SessKey: A1842D663E9A4A72XXXXXXXX303541303234373138
Copied
Norequestneeded,
leaveitblank.
{
"AccountProfileQryResult": {
"AccountProfile": {
"AccountCode": "EP9116875",
"AccountName": "EP DEV ACCT",
"AutoSchedule": true,
"AutoSettle": true,
"AutoSettleHour": 0,
"AutoSettleMinute": 0,
"BatchReport": false,
"DateCreated": "\/Date(1549902752630-0500)\/",
"DateModified": "\/Date(1549903584797-0500)\/",
"ID": 205,
"IndustryCode": "",
"TimeZone": "Dateline Standard Time",
"TransReport": false
},
"ErrCode": 0,
"ErrMsg": "",
"FunctionOk": true,
"RespMsg": "Successfully Returned Account profile for Account ID 205"
}
}
Copied
using System;
using System.IO;
using System.Net;
using Newtonsoft.Json;
private void ProfileQuery() {
/// Session Key gathered using the Authenticate Command.
SessKey = "52B1F6B36F35400EA4303237343341303337353938";
// create Request
WebRequest request = WebRequest.Create("https://easypay5.com/APIcardProcREST/v1.0.0/Query/AccountProfile");
request.Method = "POST";
request.ContentLength = 0;
// use your session key obtained when you authenticated
request.Headers.Add("SessKey: " + SessKey);
string Myheaders = request.Headers.ToString();
string responseContent = null;
// Using the Try block will catch communication errors
try {
using (WebResponse response = request.GetResponse()) {
using (Stream stream = response.GetResponseStream()) {
using (StreamReader sr99 = new StreamReader(stream)) {
responseContent = sr99.ReadToEnd();
}
}
}
}
catch (Exception ee) {
logError("Problem communicating with EasyPay Service:" + ee.Message);
return;
}
// Check for null Response as this would be a critical communication error as well
if (responseContent == null) {
logError("Critical Error!, null response");
return;
}
/// develop Response Object
var Result = JsonConvert.DeserializeObject<dynamic>(responseContent);
bool FunctionOk = (bool)Result.AccountProfileQryResult.FunctionOk;
int ErrCode = (int)Result.AccountProfileQryResult.ErrCode;
string ErrMsg = (string)Result.AccountProfileQryResult.ErrMsg;
string RespMsg = (string)Result.AccountProfileQryResult.RespMsg;
//Check for unexpected Errors on cloud servers. If errors found Stop Processing and check ErrorCodes
if (!FunctionOk) {
logError(RespMsg + " " + ErrCode + " " + ErrMsg);
return;
}
/// retrieve account profile data
string profile = JsonConvert.SerializeObject(Result.AccountProfileQryResult.AccountProfile);
Response.Write(profile);
}
private static void logError(string msg) {
// implement your logging function here.
}