Articles in this section
Category / Section

Retrieve data source column metadata using a REST API

Published:

Introduction

Bold BI’s REST API provides a seamless way to programmatically interact with the platform, including the ability to retrieve data source column metadata

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

Retrieving metadata on columns from a specified data source using the API.

Once authenticated, you can proceed to retrieving metadata on columns from a specified data source by sending a GET request to the appropriate endpoint.

API Endpoint

  • URL: http://{domain}/bi/api/site/{sitename}/v5.0/datasource/getcolumns/{itemId}
  • Method: GET
  • Content-Type: application/json
  • Authorization: Bearer <access_token>

Response

{
   "ApiStatus": true,
   "Data": [
       {
           "Name": "string",
           "DesiredType": "string",
           "DataType": "string",
           "DefaultDataType": "string",
           "IsVisible": bool
       }
   ],
   "Status": true
} 
Field Description
Name Column name
DesiredType The original name of the column.
DataType The type of data currently being used.
DefaultDataType The default data type.
IsVisible Display the column either in a hidden or visible state.

image.png

Below is an example API request that returns the available columns and its data type details, as shown in the UI above.

image.png

Conclusion

By following these steps, you can successfully get the data source columns metadata using Bold BI’s REST API.

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