Articles in this section
Category / Section

Create the User Based filter value using REST API

Published:

Introduction

Bold BI’s REST API provides a seamless way to programmatically interact with the platform, including the ability to create the user based filter value.

REST API for Obtaining an Access Token

Before making any changes, it is necessary to authenticate with the Bold BI server to obtain an access token. This token must be included in the header of all API requests to ensure they are authorized.

Authentication Endpoint

Field Value
URL http://{domain}/bi/api/site/{sitename}/token
Method POST
Content-Type application/json

Request Body Schema

{
    "username": "string",
    "password": "string",
    "grant_type": "password"
}
  • username: The email address of the user.
  • password: The password of the user.
  • grant_type: The type of credentials used to authorize the request for an access token. The value allowed is password.

Response

{
    "access_token": "string",
    "token_type": "string",
    "expires_in": "string",
    "Email": "string"
}

Example

Request Response
image.png
image.png

Get the data source Id

Option 1: Get the Data source from UI
  1. Select the three dots located on the data source within the data source page, and then click on the Info option.
    image.png
  2. Please refer to the screenshot below and note down the item ID.
    image.png
Option 2: Get the Data sources from REST API

Users who have created the data sources can view the lists of data sources, Get DataSources

Search and fetch a particular data source. The provided keyword will search the data source name.
Example: q=web

image.png

Create a user-based filter value using REST API

  1. The user-based filter can be supported only for String and Date columns.
  2. It is only allowed to create user-based filters to manual mode using the REST API.
  3. It is not possible to assign the RelativeDateFilter to a string column.
  4. There is currently no API for removing the user filter in the data source.
{
   "BasicFilters": [
       {
           "Mode": "Manual",
           "UserInfo": [
               {
                   "IsGroup": boolean,
                   "IsCheckAll": boolean,
                   "SelectedValues": [
                   ],
                   "IncludeFutureValues": boolean,
                   "RelativeDateFilter": null,
                   "UserId": "string",
                   "GroupId": "string"
               }
           ],
           "ShowRecordsToUnmappedUsers": boolean,
           "ColumnId": "string",
           "Name": "string",
           "BasedOn": "String"
       }
   ],
   "AdvancedFilter": null
} 
Parameters Optional Details Applicable Values
Mode Mandatory Default (Manual) Manual Mode - Only Supported in REST API.
IsGroup Optional Denotes the user is Group or not. Boolean
IsCheckAll Optional It represents whether all values in the column need to be checked for filtering. Boolean
SelectedValues Mandatory It represents the values in the columns that are going to be fetched using a filter. Array of string value
IncludeFutureValues Optional It represents the values; items will be added in the future. Boolean
RelativeDateFilter Optional It represents the value from which we are going to fetch data using relative filter options in the Date column. By Default, value is null. Array of Object.
UserId Mandatory It is required for the user-based filter to be user. It represents the user ID we use for Bold BI to fetch Data using filter. Assign a null value when setting the User-based filter value for the Group. string
GroupId Optional It is required for the user-based filter to be group. It represents the user Group we use for Bold BI to fetch Data using filter. Assign a null value if the User filter value is set to User… string
ShowRecordsToUnmappedUsers Optional It represents the data that needs to be shown to other users in Bold BI. Boolean
ColumnId Mandatory It represents the column we are going to use for filtering. string
Name Mandatory It represents the name were going to assign for the filter. string
Name Mandatory It represents the name were going to assign for the filter. string
BasedOn Mandatory Mandatory It represents the value needed to set the column with the user email, full name, or group name as the data column for the filter. String (None, FullName,Email,GroupName).
AdvancedFilter Optional The default value is null and is not supported. string
Sample for creating a user filter for a string column for both users and groups in a single column.
{
   "BasicFilters": [
       {
           "Mode": "Manual",
           "UserInfo": [
               {
                   "IsGroup": false,
                   "IsCheckAll": false,
                   "SelectedValues": [
                       "ANATR"
                   ],
                   "IncludeFutureValues": false,
                   "RelativeDateFilter": null,
                   "UserId": "user@example.com",
                   "GroupId": "null"
               },
               {
                   "IsGroup": true,
                   "IsCheckAll": false,
                   "SelectedValues": [
                       "BOLID"
                   ],
                   "IncludeFutureValues": false,
                   "RelativeDateFilter": null,
                   "UserId": "null",
                   "GroupId": "System Administrator"
               }
           ],
           "ShowRecordsToUnmappedUsers": true,
           "ColumnId": "customerId",
           "Name": "UserFilter1",
           "BasedOn": "None"
       }
   ],
   "AdvancedFilter": null
}

image.png

image.png

Sample for creating a user-based filter with a relative date
{
   "BasicFilters": [
       {
           "Mode": "Manual",
           "UserInfo": [
               {
                   "IsGroup": false,
                   "IsCheckAll": false,
                   "SelectedValues": [],
                   "IncludeFutureValues": false,
                   "RelativeDateFilter": {
                       "RelativeDateFormat": "Month",
                       "DateInstance": "Past",
                       "StartDate": "07/25/1996 12:00 AM",
                       "EndDate": "10/24/1996 11:59 PM",
                       "Range": 1,
                       "UseAnchorDate": true,
                       "AnchorDate": "10/19/1996"
                   },
                   "UserId": "user@example.com",
                   "GroupId": "null"
               }
           ],
           "ShowRecordsToUnmappedUsers": true,
           "ColumnId": "orderDate",
           "Name": "UserFilter2",
           "BasedOn": "None"
       }
   ],
   "AdvancedFilter": null
} 

image.png

Sample for creating multiple user-based filters.
{
   "BasicFilters": [
       {
           "Mode": "Manual",
           "UserInfo": [
                {
                   "IsGroup": true,
                   "IsCheckAll": false,
                   "SelectedValues": [
                       "BOLID"
                   ],
                   "IncludeFutureValues": false,
                   "RelativeDateFilter": null,
                   "UserId": "null",
                   "GroupId": "System Administrator"
               }
           ],
           "ShowRecordsToUnmappedUsers": true,
           "ColumnId": "customerId",
           "Name": "UserFilter3",
           "BasedOn": "None"
       },
        {
           "Mode": "Manual",
           "UserInfo": [
               {
                   "IsGroup": false,
                   "IsCheckAll": false,
                   "SelectedValues": [],
                   "IncludeFutureValues": false,
                   "RelativeDateFilter": {
                       "RelativeDateFormat": "DAY",
                       "DateInstance": "Past",
                       "StartDate": "07/25/1996 12:00 AM",
                       "EndDate": "10/24/1996 11:59 PM",
                       "Range": 1,
                       "UseAnchorDate": true,
                       "AnchorDate": "10/19/1996"
                   },
                   "UserId": "user@example.com",
                   "GroupId": "null"
               }
           ],
           "ShowRecordsToUnmappedUsers": true,
           "ColumnId": "orderDate",
           "Name": "UserFilter4",
           "BasedOn": "None"
       }
   ],
   "AdvancedFilter": null
} 

image.png

  1. It is not recommended to use the same User ID or Group ID in different user filters when creating multiple user-based filters in single API call.
    image.png

Additional References

Was this article useful?
Like
Dislike
Help us improve this page
Please provide feedback or comments
BK
Written by Baskaran K
Updated
Comments (0)
Please  to leave a comment
Access denied
Access denied