GetChartOfAccounts - accountsIQ/API-Wiki GitHub Wiki
The GetChartOfAccounts
function retrieves a list of all financial accounts in the general ledger for the current company.
public WSResult2<WSChartOfAccountLine[]> GetChartOfAccounts(string token)
Parameter | Type | Description |
---|---|---|
token | String | The session token retrieved during authentication. |
The following example gets all the accounts for a company and outputs each of the accounts and their details to the console.
Integration ws = new Integration();
String auth = ws.Login(entityID, partnerKey, userKey);
if (auth != null)
{
WSResult2OfArrayOfWSChartOfAccountLine result = ws.GetChartOfAccounts(auth);
var listOfAccounts = result.Result;
if (result.Result.FirstOrDefault() == null)
{
Console.WriteLine($" No accounts found.");
}
foreach(var account in listOfAccounts)
{
Console.WriteLine($"AccountType: {account.AccountType} " +
$"\nBalanceSheetType: {account.BalanceSheetType} " +
$"\nCode: {account.Code} " +
$"\nCurrencyCode: {account.CurrencyCode} " +
$"\nDefaultTaxID: {account.DefaultTaxID}" +
$"\nDepartmentID: {account.DepartmentID}" +
$"\nDescription: {account.Description}" +
$"\nGLCategory: {account.GLCategory}" +
$"\nGLCategoryID: {account.GLCategoryID}" +
$"\nGLCategoryTypeDescription: {account.GLCategoryTypeDescription}" +
$"\nGLCategoryTypeID: {account.GLCategoryTypeID}" +
$"\nGLGroup: {account.GLGroup}" +
$"\nGLGroupID: {account.GLGroupID}" +
$"\nGLSubCategory: {account.GLSubCategory}" +
$"\nGLSubCategoryID: {account.GLSubCategoryID}" +
$"\nIsActive: {account.IsActive}" +
$"\nIsDepartmental: {account.IsDepartmental}" +
$"\r\n----------------------------------\r\n");
}
Console.ReadLine();
}