Query parameters can be specified as part of a URL, e.g. for viewing a dashboard. Especially for embedded dashboards, it may be necessary or useful to construct URLs to dashboards with specific parameters applied. This page describes how the dashboard parameters, like aggregations as well as time range and custom filters, can be encoded in a URL.
1. Aggregation Parameter
Values for time aggregation use the form aggregation=<value>
in a URL, with the possible values being: second, minute, hour, day, week, month, quarter,
year
. The following links illustrate this parameter:
2. Time Range Parameter
A time range filter uses the form timerange=<value>
in a URL. Multiple formats for the value are supported.
From-To: <unix_timestamp>~<unix_timestamp>
Before: ~<unix_timestamp>
After: <unix_timestamp>~
Last n units: <number>_full_<unit>
Last n units (ending now): <number>_<unit>
This unit: thisfull_<unit>
This unit (ending now): this_<unit>
Previous unit: previous_<unit>
3. Custom Filters
All custom filters to be included in a URL are combined in a URL-encoded JSON structure:
{ <filter_1>: [<filter_value_1>, <filter_value_2>,...], <filter_2>: [<filter_value_1>, <filter_value_2>,...], ... }
In JavaScript, this can be achieved via encodeURIComponent, e.g.
encodeURIComponent('{"countries":["United States","Canada"],"origin_airports":["LAX"]}') "%7B%22countries%22%3A%5B%22United%20States%22%2C%22Canada%22%5D%2C%22origin_airports%22%3A%5B%22LAX%22%5D%7D"