Skip to content
Snippets Groups Projects
account_history_api.yml 13.07 KiB
# Generated by Scrape::ApiDefinitionsJob: 2019-10-08 17:22:36 UTC
# See: https://git.io/vx5CY
---
- name: Account history API
  description: Used to lookup account history information. **These AppBase API methods are still under development and subject to change.**
  methods:
    - api_method: account_history_api.get_account_history
      purpose: |
        Returns a history of all operations for a given account.  Parameters:
        
        * `account:string`
        * `start:int`. e.g.: -1 for reverse history or any positive numeric
        * `limit:int` up to 1000
        * `include_reversible:boolean` (optional) If set to true also operations from reversible block will be included
        * `operation_filter_low:int` (optional)
        * `operation_filter_high:int` (optional)
        
        If either `operation_filter_low` or `operation_filter_high` are set, the set of returned operations will include only these matching bitwise filter.
        
        For the first 64 operations (as defined in [protocol/operations.hpp](https://gitlab.syncad.com/hive/hive/-/blob/master/libraries/protocol/include/hive/protocol/operations.hpp)), set the corresponding bit in `operation_filter_low`; for the higher-numbered operations, set the bit in operation_filter_high (pretending operation_filter is a 128-bit bitmask composed of `{operation_filter_high, operation_filter_low}`)
        
        | `account` (string) | `start` (int) | `limit` (int) | `include_reversible` (boolean) | `operation_filter_low` (int) | `operation_filter_high` (int)  | |
        |--------------------|---------------|---------------|--------------------------------|------------------------------|--------------------------------|-|
        | `"hiveio"` | `1000` | `1000` | | | | Queries the account named `hiveio` starting on the latest item in history, up to 1,000 results. |
        | `"alice"` | `-1` | `1000` | | | | Queries the account named `alice` starting on the oldest item in history, up to 1,000 results. |
        | `"bob"` | `-1` | `1000` | true | 1 | | Queries **only votes** by the account named `bob` starting on the oldest item in history, up to 1,000 results. |
        | `"charlie"` | `-1` | `1000` | true | 262144 | | Queries **only custom jsons** by the account named `charlie` starting on the oldest item in history, up to 1,000 results. |
        | `"emma"` | `-1` | `1000` | true | 0 | 1 | Queries **only proposal payments** to the account named `emma` starting on the oldest item in history, up to 1,000 results. |

        Also see: [Paginated API Methods]({{ '/tutorials-recipes/paginated-api-methods.html#account_history_apiget_account_history' | relative_url }})
      parameter_json: {"account":"","start":"18446744073709551615","limit":1000,"include_reversible": true,"operation_filter_low":4294967295,"operation_filter_high":4294967295}
      expected_response_json: |
        {"history": [
          [99, {
            "trx_id": "0000000000000000000000000000000000000000",
            "block": 0,
            "trx_in_block": 4294967295,
            "op_in_trx": 0,
            "virtual_op": 0,
            "timestamp": "2019-12-09T21:32:39",
            "op": {}
          }]
        ]}
      curl_examples:
        - '{"jsonrpc":"2.0", "method":"account_history_api.get_account_history", "params":{"account":"hiveio", "start":1000, "limit":1000}, "id":1}'
        - '{"jsonrpc":"2.0", "method":"account_history_api.get_account_history", "params":{"account":"hiveio", "start":-1, "limit":1000}, "id":1}'
        - '{"jsonrpc":"2.0", "method":"account_history_api.get_account_history", "params":{"account":"bob", "start":-1, "limit":1000, "include_reversible": true, "operation_filter_low": 1}, "id":1}'
        - '{"jsonrpc":"2.0", "method":"account_history_api.get_account_history", "params":{"account":"charlie", "start":-1, "limit":1000, "include_reversible": true, "operation_filter_low": 262144}, "id":1}'
        - '{"jsonrpc":"2.0", "method":"account_history_api.get_account_history", "params":{"account":"emma", "start":-1, "limit":1000, "include_reversible": true, "operation_filter_low": 0, "operation_filter_high": 1}, "id":1}'
      expected_curl_responses:
        - Could not find API account_history_api
        - Could not find API account_history_api
      client_docs:
        - '[hive-js](https://gitlab.syncad.com/hive/hive-js/tree/master/doc#get-account-history)'
        - '[beem](https://beem.readthedocs.io/en/latest/apidefinitions.html#get-account-history)'
        - '[hive-ruby](https://www.rubydoc.info/gems/hive-ruby/Hive/Api)'
    - api_method: account_history_api.get_ops_in_block
      purpose: |
        Returns all operations contained in a block.  Parameter:
          
          * `block_num:int`
          * `only_virtual:boolean`
          * `include_reversible:boolean` (optional) If set to true also operations from reversible block will be included if block_num points to such block.
      parameter_json: {"block_num":0,"only_virtual":false,"include_reversible": true}
      expected_response_json: |
        {
          "ops": [{
            "trx_id": "0000000000000000000000000000000000000000",
            "block": 0,
            "trx_in_block": 4294967295,