Query Syntax
Query Syntax Documentation for Ortege API
The Ortege API allows for flexible and powerful querying of blockchain data through various operators and syntax options. This section provides a reference for building queries to retrieve data efficiently and accurately.
Basic Query Structure
Each query consists of:
Measures: Aggregated data points, such as counts or sums.
Dimensions: Non-aggregated attributes for grouping and filtering.
Time Dimensions: Time-based dimensions for filtering by date or time ranges.
Filters: Conditions to include or exclude specific data points.
Example Query:
Operators
The filters parameter allows you to specify various operators to control how data is retrieved. Here are some common operators available in the Ortege API:
equals
: Matches values exactly.notEquals
: Excludes values that match exactly.contains
: Matches values that contain a specific substring.startsWith
: Matches values that start with a specific substring.endsWith
: Matches values that end with a specific substring.gt
(Greater Than): Matches values greater than a specified value.gte
(Greater Than or Equal To): Matches values greater than or equal to a specified value.lt
(Less Than): Matches values less than a specified value.lte
(Less Than or Equal To): Matches values less than or equal to a specified value.inDateRange
: Matches dates within a specified range.
Combining Multiple Filters
You can apply multiple filters within a query to refine the data retrieved further. For example, to get PoX rewards from cycle 94
with amount
values between 0.01 BTC
and 1 BTC
, you could use:
Date Ranges and Granularity
Time Dimensions can be specified with custom date ranges and granularity, making it easy to group data by hour, day, month, etc.
Example using dateRange
and granularity
:
This example groups the amount
measure by day over the last seven days.
Additional Resources
For more details on advanced query syntax and Cube’s query format, refer to the Cube documentation: Cube Query Format.
Last updated