nxt.http

## Class GetAccountLedger

- java.lang.Object
- - nxt.http.APIServlet.APIRequestHandler
  - - nxt.http.GetAccountLedger

-     public class GetAccountLedger
      extends APIServlet.APIRequestHandler

  The GetAccountLedger API will return entries from the account ledger. The account ledger tracks all account changes as determined by the nxt.ledgerAccounts, nxt.ledgerLogUnconfirmed and nxt.ledgerTrimKeep properties.

  Request parameters
  Name | Description
  --- | ---
  account | Account identifier or Reed-Solomon identifier This is an optional parameter and restricts the search to entries matching the account identifier.
  adminPassword | Administrator password. The administrator password is required if more than nxt.maxAPIRecords entries are to be searched.
  event | Event identifier. The event identifier is ignored unless 'eventType' is also specified. This is an optional parameter and restricts the search to entries matching both 'eventType' and 'event'. Note that the asset identifier, currency identifier or digital goods identifier is the same as the transaction identifier of the creating transaction.
  eventType | Event type. This is an optional parameter and restricts the search to entries matching 'eventType'.
  holding | Holding identifier. The holding identifier is ignored unless 'holdingType' is also specified. This is an optional parameter and restricts the search to entries matching both 'holdingType' and 'holding'.
  holdingType | Holding type. This is an optional parameter and restricts the search to entries matching 'holdingType'.
  includeTransactions | Specify TRUE to include the transaction associated with a ledger entry. The default is FALSE.
  includeHoldingInfo | Specify TRUE to include the corresponding asset or currency info (name, decimals) with each ledger entry. The default is FALSE.
  firstIndex | Return matching entries starting from this index, inclusive, default is 0. Sort is always most recent first.
  lastIndex | The index of the last matching entry to return, inclusive. The maximum number of entries returned is limited by the nxt.maxAPIRecords property unless the administrator password is specified.

  Ledger entry fields
  Name | Description
  --- | ---
  account | Account identifier.
  accountRS | Account Reed-Solomon identifier.
  balance | Update balance for the holding identified by 'holdingType'.
  block | Block that created the ledger entry. The current ledger entry will be removed if the block is removed from the blockchain. A new ledger entry will be created when either the block is added to the blockchain again or the transaction is included in a different block.
  change | Change in the balance for the holding identified by 'holdingType'.
  event | The block or transaction associated with the event.
  eventType | Event causing the account change.
  height | The block height associated with the event.
  holding | The item identifier for an asset or currency balance.
  holdingType | The item being changed (account balance, asset balance or currency balance).
  isTransactionEvent | TRUE if the event is associated with a transaction and FALSE if it is associated with a block.
  ledgerId | The ledger entry identifier. This is a counter that is incremented each time a new entry is added to the account ledger. The ledger entry identifier is unique to the peer returning the ledger entry and will be different for each peer in the network. A new ledger entry identifier will be assigned if a ledger entry is removed and then added again.
  timestamp | The block timestamp associated with the event.
  transaction | Transaction associated with the event if 'includeTransactions' is TRUE.

  Values returned for 'holdingType'
  Name | Description
  --- | ---
  ASSET_BALANCE | Change in the asset balance. The asset identifier is the 'holding'.
  CURRENCY_BALANCE | Change in the currency balance. The currency identifier is the 'holding'.
  NXT_BALANCE | Change in the NXT balance for the account. There is no 'holding'.
  UNCONFIRMED_ASSET_BALANCE | Change in the unconfirmed asset balance. The asset identifier is the 'holding'.
  UNCONFIRMED_CURRENCY_BALANCE | Change in the unconfirmed currency balance. The currency identifier is the 'holding'.
  UNCONFIRMED_NXT_BALANCE | Change in the unconfirmed NXT balance for the account. There is no 'holding'.

- - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected org.json.simple.JSONStreamAware` | `processRequest(javax.servlet.http.HttpServletRequest req)` Process the GetAccountLedger API request

    - ### Methods inherited from class nxt.http.APIServlet.APIRequestHandler

      `allowRequiredBlockParameters, getAPITags, getFileParameter, getParameters, isPassword, isTextArea, processRequest, requireBlockchain, requireFullClient, requirePassword, requirePost, startDbTransaction`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Method Detail

    - #### processRequest

          protected org.json.simple.JSONStreamAware processRequest(javax.servlet.http.HttpServletRequest req)
                                                            throws NxtException

      Process the GetAccountLedger API request
      Specified by:
        `processRequest` in class `APIServlet.APIRequestHandler`
      Parameters:
        `req` - API request
      Returns:
        API response
      Throws:
        `NxtException` - Invalid request