Get Account Listing
Request
POST:/{accountBookId}/account/listingCertain understanding is needed when setting up the filter.
Important Note
- The
leafOnly,searchTextrequest parameters and theaccTypes,specialAccTypesfilters in account listing option input model have an "AND (&&)" type relationship.
Example:
If leafOnly = "true" and searchText input in filled in, the query will only include any non-parent, non-control accounts that match the search criteria.
- The filter options fields in
accTypesandspecialAccTypesfilters have an "OR (||)" type relationship.
Example:
If balanceSheetType = "true" and sales = "true" in accTypes filter, the query will include any accounts that are either balance sheet accounts or profit/loss accounts under "Sales" account type.
Please take note of the above to avoid ending up with a result that is always empty.
Example of filter that results in empty result
Example:
Setting leafOnly = "true" in request parameters and debtorControl = "true" in special account type option input model will always return empty result.
This is because debtor control account is never a leaf account.
Request Parameters
| Parameter | Description | Type | |
|---|---|---|---|
page | Page index of returned records. Each page contains at most 100 records. Using a page index beyond the number of available pages will result in empty result. | number | required |
leafOnly | Leaf only flag. When field value is "true", parent accounts and debtor/creditor control accounts will be excluded from the query. | boolean | nullable |
searchText | Search text. Search value will trigger search operation in accNo and description fields of Account View Model. | string | |
field | List of fields to be included in records returned by query. Field names can be found here. (case-insensitive) | array[string] |
Request Body
object: Account Listing Option Input Model
Example Request Body
Example: Get list of accounts that are either balance sheet accounts, profit loss accounts, current liabilities accounts, bank accounts, cash accounts or retained earning accounts.
{
"filterByAccTypes": true,
"filterBySpecialAccTypes": true,
"accTypes": {
"balanceSheetType": true,
"profitLossType": true,
"currentLiabilities": true
},
"specialAccTypes": {
"bank": true,
"cash": true,
"retainedEarning": true
}
}
Example Request URL:
Example: Get account listing excluding parent accounts and debtor/creditor control accounts with additional "accType" and "specialAccType" fields with searchText value "cash".Parameters:
accountBookId = 1 page = 1 leafOnly = true searchText = "cash" field = ["accType", "specialAccType"] URL:
POST: https://accounting-api.autocountcloud.com/1/account/listing?page=1&leafOnly=true&searchText=cash&field=accType&field=specialAccType Response
Success Response
Status Code: 200
Response Body
| Field | Description | Type |
|---|---|---|
data | Response data. | array[Account View Model] |
totalCount | Number of records retrieved. | number |
Example Success Response Body
{
"data": [
{
"AccNo": "310-1000",
"CurrencyCode": "MYR",
"Description": "CASH AT BANK",
"AccType": "CA",
"SpecialAccType": "SBK"
},
{
"AccNo": "310-1001",
"CurrencyCode": "MYR",
"Description": "CASH AT BANK 2",
"AccType": "CA",
"SpecialAccType": "SBK"
},
{
"AccNo": "320-0000",
"CurrencyCode": "MYR",
"Description": "CASH IN HAND",
"AccType": "CA",
"SpecialAccType": "SCH"
}
],
"totalCount": 3
}
Error Response
Response Body
object: Error Response Model
Example Error Response Body
{
"statusCode": 401,
"message": "401 Unauthorized."
}