Queries Overview
Ledger objects in Onyx Mesh are represented as key-value JSON objects. To retrieve data, you perform a query with optional parameters.
Query TypesLink to this section
There are two types of queries: list queries and sum queries.
List QueryLink to this section
A list query returns a paginated set of objects. All objects support the list query. Most are returned most-recent-first; token groups are ordered by account, then asset, then tags.
For details and examples, see List Queries.
Sum QueryLink to this section
A sum query is an aggregate over the amount fields in a list of objects. Only actions and token groups support the sum query.
For details and examples, see Sum Queries.
Query ParametersLink to this section
FiltersLink to this section
The primary query parameter is a filter, which allows targeting specific fields in a set of objects.
For details and examples, see Filters.
Group ByLink to this section
Sum queries on actions and token groups also accept a group by query parameter that indicates how amounts should be summed.
The query will sum the amounts in the resulting set of actions or token groups where the values of the "group" field are identical. This is analogous to the "GROUP BY" clause in SQL.
For details and examples, see Group By in Sum Queries.
PaginationLink to this section
Results of all queries are paginated. There are two methods for handling these:
- Retrieving a page of results at a time – useful for implementing pagination in an end-user application, such as infinite scroll.
- Iterating though individual results - useful for processing results in an application, such as generating a report (where pages are incidental).
For details and examples, see Pagination.