Articles in this section
Category / Section

Updating Data source Connection String Using Bold BI API

Published:

Bold BI’s API provides a convenient way to update the connection string for your data sources. This article will guide you through the steps to update a connection string using the Bold BI API.

Steps to Update Connection String:

1: Obtain Access Token:

To start, you need to authenticate with the Bold BI server and obtain an access token. Use the following JSON structure in a tool like Postman, replacing Bold BI_username and Bold BI_password with your actual Bold BI credentials.

Endpoint:

http://localhost:65016/bi/api/site/site1/token

Request sample:

{
  "username": "Bold BI_username",
  "password": "Bold BI_password",
  "grant_type": "password"
}

Select the POST method and send the request to receive your access token.

image.png

2. To get the existing Data Source ID:

Via API:

  • Before updating the connection string, you need to identify the data source by obtaining its unique ID.

  • Select the GET method and enter the endpoint to list all data sources.

      http://localhost:65016/bi/api/site/site1/v4.0/datasources
    
  • Find the data source you want to update and note its ID.

    image.png

Via UI:

We can get the data source ID in two ways:

  1. Navigate to the data source page, click on the three dots, and select the “Info” option. The Item ID corresponds to the data source ID.

    image.png

    image.png

  2. Edit the data source and you can find the ID in the URL highlighted below:

    image.png

3. Prepare the API Request to update:

To update the connection string, you will need to send a PUT request to the http://localhost:65016/bi/api/site/site1/v4.0/datasources endpoint with the updated connection string in the request body.

  • Add the DataSourceId to the request sample obtained in the previous step.

  • In the request body, include the ConnectionString property with the new connection string value. Here, I have changed the table name.

      {
        "Name": "SQL-Test",
        "Type": "sqlserver",
        "DataSourceId": "56e3d146-7e23-4764-898a-cdc8d856dab5",
        "Description": "",
        "Connection": {
        "Servername": "localhost",
        "IntegratedSecurity": false,
        "Username": "username",
        "Password": "password",
        "Database": "NORTHWND",
        "Schemaname": "dbo",
        "Tablename": "Customers",
        "Impersonate": false,
        "AdvancedSettings": "",
        "IsEnableSSL": false,
        "CommandTimeout": "300"
        }
      }
    

image.png

image.png

Supported Data Source: amazonathena, amazonaurora, amazonrds, awsopensearch, redshift, azuresynapseanalytics, cdata, clickhouse, elasticsearch, googlecloudmysql, googlecloudpostgresql, influxdb, mariadb, ssas, mysql, oracle, postgresql, presto, singlestore, sqlserver, snowflake, sparksql, odbc, rockset.

Please find the connection information for the specific data source at the provided link.

4. Get data source update using data source ID/UI.

After updating the connection string, it’s important to verify that the data source is functioning correctly.

You can check the updates by two ways:

  • Use the GET method and send the endpoint http://localhost:65016/bi/api/site/site1/v4.0/datasources/datasourceId to retrieve the updated data source details. No need to send any request to the body, just select the “none” option and send the request. You can check the response sample; there will be a difference in the version and modified date.

image.png

  • The other way is to check in the UI. That is, you can edit the data source and check the modified tables.

Additional References:

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