Examples: query, "exact match", wildcard*, wild?ard, wild*rd
Fuzzy search: cake~ (finds cakes, bake)
Term boost: "red velvet"^4, chocolate^2
Field grouping: tags:(+work -"fun-stuff")
Escape special characters +-&|!(){}[]^"~*?:\ - e.g. \+ \* \!
Range search: properties.timestamp:[1587729413488 TO *] (inclusive), properties.title:{A TO Z}(excluding A and Z)
Combinations: chocolate AND vanilla, chocolate OR vanilla, (chocolate OR vanilla) NOT "vanilla pudding"
Field search: properties.title:"The Title" AND text
 
Answered
What is the best way to get Account History?

Hello,

I want to retrieve transactions for a view for my users. I want to be able to window them so that the payload is small and I want my users to be able to search specific time frames. What is the best way to do this?

Posted 4 years ago
Trey Teter
124 × 2 Administrator
Votes Newest

Answers


Yes,

The best way to get windowed account history is by using using https://docs.q2developer.com/api_references/hq_api/q2_api/GetAccountHistoryByIdWindowed.html
A great code example of how to use this is from the Caliper API:

get_account_history = GetAccountHistoryByIdWindowedWithUserId.ParamsObj(
            self.logger,
            host_account_id=history_parameters.host_account_id,
            page_size=history_parameters.page_size,
            page_number=history_parameters.page_number,
            perform_history_lookup=True,
            perform_memo_lookup=False,
            perform_nsf_lookup=False,
            user_id=history_parameters.user_id,
            optional_sort='',
            optional_filter=GetAccountHistoryByIdWindowedWithUserId.OptionalFilter([
                GetAccountHistoryByIdWindowedWithUserId.FilterItem(
                    is_or_operator_not_and=0,
                    operand='GT',
                    parens_before=0,
                    parens_after=0,
                    field_name='PostDate',
                    comparison_value=history_parameters.from_date

                ),
                GetAccountHistoryByIdWindowedWithUserId.FilterItem(
                    is_or_operator_not_and=0,
                    operand='LT',
                    parens_before=0,
                    parens_after=0,
                    field_name='PostDate',
                    comparison_value=history_parameters.to_date
                )
            ]),
            hq_credentials=self.hq_credentials
        )
        results = await GetAccountHistoryByIdWindowedWithUserId.execute(get_account_history)

The Caliper API code will be made available for external developers to view and request changes at some point. Q2 is polishing the code a little bit more before making it externally viewable.

-Trey

Posted 4 years ago
Edited 4 years ago
Trey Teter
124 × 2 Administrator