Note: Only the filter details need to be added in the existing query string concatenation. These are the common required details needed to generate a token: serverUrl, siteIdentifier, userEmail, dashboardId, and embedSecret, which you can refer to in the Generate Embed Token (v13) page.
Node
app.post('/tokenGeneration', function (req, res) {
// Define row-level filter
const filter = "[{shipCountry=India}]";
// Build query string
let queryString = "embed_nonce=" + crypto.randomUUID();
queryString += "&embed_dashboard_id=" + dashboardId;
queryString += "&embed_user_email=" + userEmail;
// Add filter
queryString += "&embed_datasource_filter=" + filter;
});Filter Syntax Examples
| Scenario | Query |
|---|---|
| Single Filter | &embed_datasource_filter=[{&Param=Value}] |
| Multiple Filters | &embed_datasource_filter=[{&Param1=Value1&Param2=Value2}] |
| List Format (IN) | &embed_datasource_filter=[{&Param=IN(Value1,Value2)}] |
Note: Filters must be enclosed in [] square brackets and {} curly braces. You can also achieve RLS for custom columns using dashboard parameters.
Custom Attributes are name–value pairs that can be defined at the user, group, or site level. It can be enforced by passing an embed_custom_attribute attribute in the embed token. They allow dashboards to dynamically adjust queries, expressions, or data source connections to enforce RLS.
Node
app.post('/tokengeneration', function (req, res) {
// Define custom attribute
const customAttribute = '[{"database_name":"DB2"}]';
let queryString = "embed_nonce=" + crypto.randomUUID();
queryString += "&embed_dashboard_id=" + dashboardId;
queryString += "&embed_user_email=" + userEmail;
// Add custom attribute
queryString += "&embed_custom_attribute=" + customAttribute;
});Examples:Custom Attribute Syntax
| Scenario | Syntax | Example |
|---|---|---|
| Single Attribute | [{"Attribute_Name":"Value"}] |
&embed_custom_attribute='[{"database_name":"DB1"}]' |
| Multiple Attributes | [{"Attr1":"Value1","Attr2":"Value2"}] |
&embed_custom_attribute='[{"department":"IT","name":"David"}]' |
| List Format (IN) | [{"Attribute_Name":"IN('Value1','Value2')"}] |
&embed_custom_attribute='[{"department":"IN('CSE','EEE')"}]' |