Dashboard Filter API

FreeGrowthEnterprise

Overview

This feature enables customers to apply filters to embedded widgets and publicly shared dashboards by adjusting the query using an API. These widget and dashboard variants can then be returned via a unique URL.

Specifically, the date range, time zone, and the properties of the query can be modified. Parameters of the query are modified based on matches and replacements as described below.

How to Configure an Embedded Widget Filter

  1. Create an embedded widget or public dashboard
  2. Create a Variant ID by calling the Variant Creation API
  3. Request a Dashboard or Widget variant by including the query string parameter ‘dvid’ with the Variant ID in the URL.

Create a Dashboard or Widget Variant ID

Indicative offers a secure API to create dashboard variants. Before requesting a variant on any of your public dashboards via the URL, it must have first been created using the API as described below. 

You may create dashboard variants by passing in your specified parameters as either a JSON encoded entity in your request or as query parameters on your request's URI. There are a number of prerequisites that must be completed  before calling this API:

 

Prerequisite: Enable Dashboard Sharing

To use Dashboard Variants, Public Access must be enabled for the dashboard. 

Navigate to a dashboard, click on “Manage Dashboard” and select “Dashboard Settings” from the menu at the top right. 

iPKjt-9fBdJJhqkdaTVkZGdDS2RUSEXnMy4s5gm0kIi2wRyn0x4DpNXYSdhyeCoaUit7P4anID1rWp_uFGjzkIExMm292hk8UmsmDoUy5odGtltDINkClhc49vrP_lI8qMv_TeTE.png

Select Enable Sharing in the Public Access section. 

wD0i_l5p7XGSUdSsdUq9OFHOH2qnW48lTA8N6AGIh2yB_-MyKoAtQtmA91IJWGuiMn8YM_Pb7hEjMlZDssmgQo70XuZbWKAFCL7s8IIduAZPhKEgDc1E2Dh1K1gYfG6R4EyTbcAi.png

 

Prerequisite: Retrieve the Dashboard ID

To use the Variant Creation API, you will need the Dashboard ID for a dashboard. This can be found either in your Dashboard URL, or through the Indicative application.

 

From the URL

Dashboard IDs can be retrieved by observing the URL when viewing a dashboard in Indicative. Specifically, the “did” parameter contains the Dashboard ID.  For example:

https://app.indicative.com/#/dashboards?did=085045b7-f7bd-4378-9b56-f3ed0e571bd3&pid=04d5cec0-a25c-4d7a-864d-f7f7deece4fd

 

From the Indicative Application

The Dashboard ID and the full variant creation API URL can be retrieved through the Indicative Web Application. 

Navigate to a dashboard, click on “Manage Dashboard” and select “Dashboard Settings” from the menu at the top right. 

iPKjt-9fBdJJhqkdaTVkZGdDS2RUSEXnMy4s5gm0kIi2wRyn0x4DpNXYSdhyeCoaUit7P4anID1rWp_uFGjzkIExMm292hk8UmsmDoUy5odGtltDINkClhc49vrP_lI8qMv_TeTE__1_.png

Look for the section titled Dashboard Variant API Endpoint.  Click on the URL to copy to your clipboard.

CezpTRXnJ7Rz2uGW8G5_R_7WZI1hADc_8ovs2W0eiwyzcqt_YFMCM-Y8uGbc695Q66s5IqPZkLBQzQlb3cPBW37mQ5uw7oO0zuUOHjszA4h7zZ9MEKxsSfQGpYtiscvWqA4STzFN.png

 

Prerequisite: API Authentication

Indicative's Variant Creation API requires HTTPS/SSL and uses Basic Authentication header for all requests. Basic Authentication is a simple authentication scheme built into the HTTP protocol. The client sends HTTP requests with the Authorization header that contains the word Basic followed by a space and a Base64-encoded string username:password. 

Use your Project API Key as the username and your Private Access Token as the password. This information can be found on the Project Page in the Indicative web application. Please treat your Private Access Token as you would a password - it is meant to only be known to you.

 

An example curl :

curl -v -u "apiKey:accessToken" \ 
https://web.indicative.com/service/dashboard/variant/{dashboardId}
  • * curl’s ‘-u’ parameter automatically encodes the username and password and inserts them into the Authorization header. Depending on your client implementation you may need to do this manually. 

 

Creation API Endpoint

https://web.indicative.com/service/dashboard/variant/{dashboardId}

 

Creation API Request

Requesting Indicative's Variant Creation API requires you to pass in your dashboard ID as part of the request URI as well as additional parameters to define the variant.

Endpoint

POST /service/dashboard/variant/{dashboardId}

Request Headers

Basic Authentication where your project's API Key is the username and your project's Private Access Token is the password

Request Parameters

The variant parameters as defined below in this document. Can be passed either as a JSON object via the request entity or as query parameters on the request URI

 

Creation API Response

The response to the Indicative's Variant Creation API is a JSON object including information about the dashboard variant.

id

A string representing the ID of the requested variant. Use this to as the value for the dvid parameter when requesting a variant of your public dashboard

arguments

The parsed parameters supplied to override existing values in queries on the specified dashboard.

 

Example (Request Entity)

Request

curl -H 'Content-Type: application/json' -XPOST \
-u 'apiKey:secretKey' \
"https://web.indicative.com/service/dashboard/variant/0b636d93-40b1-4ca7-862d-b71f98410c98" -d\
'{
  "dateRange": "10,day",
  "interval": "Day"
}'

 

Response

{
 "id": "b769f9f6-8a06-459c-a6bf-3d807f805b3b",
 "arguments": {
   "absoluteDateRange": null,
   "relativeDateRange": {
     "numIntervals": 10,
     "interval": "Day"
   },
   "interval": "Day",
   "timezone": null,
   "filters": null
 }
}

 

Example (Query Parameters)

Request

curl -H 'Content-Type: application/json' -XPOST \
  -u 'apiKey:secretKey' \
"https://web.indicative.com/service/dashboard/variant/0b636d93-40b1-4ca7-862d-b71f98410c98?interval=Day&dateRange=10,day"

 

Response

{
 "id": "b769f9f6-8a06-459c-a6bf-3d807f805b3b",
 "arguments": {
   "absoluteDateRange": null,
   "relativeDateRange": {
     "numIntervals": 10,
     "interval": "Day"
   },
   "interval": "Day",
   "timezone": null,
   "filters": null
 }
}

 

Variant Customization Options

 

Date Ranges

There are two methods of filtering by a date range, absolute and relative date ranges. If no date range is specified, the queries default date range is used.

 

Absolute Date Range

Parameter Name

dateRange

Parameter Value

startRange,endRange

Date Format

YYYY-MM-DD (ISO 8601)

Required

False

To change the start and end date for all widgets, simply add &dateRange= to your URL string, followed by the start date and end date, comma delimited, in ISO 8601 date format.

Special Types Constants

Use the word ‘Today’ to indicate that the endRange should always be inclusive of today.

Today

Example:

&dateRange=2020-11-15,2020-11-30

This will filter the date range to be from November 15th, 2020 to November 30th, 2020 inclusive.

&dateRange=2020-11-15,Today

This will filter the date range to be from November 15th, 2020 to Today inclusive.

 

Relative Date Range

Parameter Name

dateRange

Parameter Value

rangeNumber,rangeType

Date Format

YYYY-MM-DD (ISO 8601)

Required

False

To change your date range to a relative date range for all widgets, simply add &dateRange= to your URL string, followed by the rangeNumber and rangeType from the options below, comma-delimited.

Valid Date Type Constants

Range Type

Hour

Day

Week

Month

Year

Example:

&dateRange=7,Days

This will change the date range for all widgets in your dashboard to include the Last 7 days.

&dateRange=4,Months

This will change the date range for all widgets in your dashboard to include the last 4 months.

 

Special Cases

If a user changes the date range via the URL for funnel widgets with individual step based date ranges, we will remove the individual step date ranges, and apply the new date range to the entire funnel.

 

Time Zone

Query Parameter Name

utcOffset

Query Parameter Value

An integer corresponding to the difference in hours from Coordinated Universal Time (UTC) for a particular place and date.


Note: You can use anything mostly anything that reasonably parses to a timezone, e.g. America/New_York or EST.

Required

False

In order to change the time zone for all widgets, simply add &utcOffset= to your URL string followed by the appropriate offset integer. If utcOffset is not included, the project default time zone will be used.

Example:

&utcOffset=-5

 

Query Interval

Parameter Name

interval

Parameter Value

A string corresponding to the interval constant with which to run the query. The interval determines event timestamp grouping. For example, an interval of Day produces x-axis ticks for each day in the specified date range

Required

False

In order to change the interval for all widgets, simply add &interval= to your URL string followed by the appropriate interval constant. If interval is not included, the query interval will not be changed.

Valid Interval Constants

Interval

Hour

Day

Week

Month

Year

Example:

&interval=day

 

Query Filters

Parameter Name

filter 

(multiple parameters can be included in one URL)

Parameter Value

[match filter],[replace filter]

Filter

[propertyName,propertyOperator,propertyValue],[propertyOperator,propertyValue]

Required

False

Details of individual queries within a dashboard or widget can be filtered based on matching specific parts of the query and specifying the values the corresponding match should be changed to.  The components of a query that can be modified include the property operator and the property value. 

HyoAslv4uCiWCAD7fBu1MdNaWhGqnDjKOZ0Py21nnjJRxFgLURdzq0e931yXAiJwvIHkv7YsMmpvDNQeRm-gjKa6hdKuGxvMOxI475U4E1um-rAjRE71YJtnrQkU6Rfd98cUnPmT.png

For reference, in the screenshot above, ‘Browser’ is the property, ‘is equal to’ is the property operator, and ‘Chome’ is the property value. 

The syntax of a filter is a tuple corresponding to the matchingFilter, and the replaceFilter.

 

Matching Filter

The matching filter contains three comma-delimited parts, propertyName, propertyOperator, and propertyValue which will be used to isolate individual queries in a Dashboard or Embedded Widget. 

propertyName

The case sensitive property name to be matched.  


NOTE: This field corresponds to the raw property name, not the display value.  See the Events and  Properties section in the Indicative web application for more information. Must not contain commas ‘,’.

propertyOperator

The operator type to be matched.  See the table below for valid values. Must not contain commas ‘,’.

propertyValue

The case sensitive property value to be matched. Must not contain commas ‘,’.

   

NOTE: In a Match Filter, the * symbol can be used as a wildcard match for any component.

 

Replace Filter

When a Matching Filter matches a query row, the replacement filter is applied to it. 

propertyOperator

The operator type to be replaced.  See the table below for valid values.

propertyValue

The case sensitive property value to be replaced. 

NOTE: In a Replace Filter, the * symbol can be used to preserve the Matching Filter value of a component.

 

Multiple Filters

Multiple filters can be applied to a single URL by including multiple filter query parameters. 

 

Property Operators

The available property operators, and the corresponding constant.

Indicative operator

Operator Type

Is equal to

eq

Is not equal to

neq

Contains

c

Does not contain

nc

Is defined

id

Is not defined

ind

Greater Than

gt

Less Than

lt

Greater Than or Equal 

gte

Less Than or Equal

lte

Example 1:

Change all instances of event_id is equal to 1234 to event_id is not equal to 1234

 

Using the Query String:

&filter=[event_id,eq,1234],[neq,*]

 

Or Using JSON:

{

 "filters": [

   "[event_id,eq,1234],[neq,*]"

 ]

}

 

Example 2:

Change all instances of event_id to event_id 5678

 

Using the Query String:

&filter=[event_id,*,*],[*,5678]

 

Or as JSON 

{

 "filters": [

   "[event_id,*,*],[*,5678]"

 ]

}

 

Viewing a Dashboard or Widget Variant

Using the Variant ID generated using the Variant Creation API, add a “dvid” parameter (from the Creation API Response) to any Dashboard, Public Dashboard, or Widget URL Request.

 

Example

Standard Dashboard URL

https://app.indicative.com/#/dashboards?did=085045b7-f7bd-4378-9b56-f3ed0e571bd3&pid=04d5cec0-a25c-4d7a-864d-f7f7deece4fd

Variant Dashboard URL

https://app.indicative.com/#/dashboards?did=085045b7-f7bd-4378-9b56-f3ed0e571bd3&pid=04d5cec0-a25c-4d7a-864d-f7f7deece4fd&dvid=12345-6789-abcde

 

Updating a Dashboard

Dashboard variants are read-only. They can only be modified by updating the original dashboard within your project. Changes made to the original dashboard will propagate to their variants the next time the variant is refreshed server-side. The timing for the server-side refresh may vary.

When refreshing dashboards, Indicative uses an algorithm to balance data ‘freshness’ and efficient resource utilization. When first applying a new filter to a dashboard or widget, please allow up to 15 minutes for changes to be reflected in the dashboard’s variants. Subsequently, each request to render a dashboard or widget will display the most recently cached result before initiating an update.

0 users found this helpful