How to create the JSON structure for creating the data sources in Bold BI dashboards via REST API?
Introduction
Bold BI’s RESTful web API facilitates seamless integration with third-party applications, enabling the creation of data sources and the addition of expressions for those data sources. This guide provides a step-by-step process for creating a data source using the API and incorporating it into a Bold BI dashboard.
Authentication
To authenticate API requests, obtain an authentication token upon signing into Bold BI. This token must be included in the request header for all subsequent API interactions.
Request Authentication Token
- URL:
http://<servername>:<portnumber>/bi/api/site/site1/token
- Method:
POST
- Content Type:
application/json
Request Body Schema
{
"username": "string",
"password": "string",
"grant_type": "string"
}
Response Schema
{
"access_token": "string",
"token_type": "string",
"expires_in": "string",
"Email": "string"
}
For more details on authentication, refer to the Bold BI Authentication API Reference.
Creating Data Sources
Authorized users can create data sources in either Table Mode or Query Mode.
Creating Data Source in Table Mode
- URL:
http://<servername>:<portnumber>/bi/api/site/site1/v4.0/datasources/
- Method:
POST
- Content Type:
application/json
- Authorization:
Bearer <token>
Request Body Schema
{
"Name": "string",
"Type": "string",
"Description": "",
"Connection": {
"Servername": "string",
"Port": "string",
"Username": "string",
"Password": "string",
"Database": "string",
"Tablename": "string",
"Schemaname": "string",
"ExpressionInfo": [
{
"Expressionname": "string",
"Displaytext": "string"
}
]
}
}
Creating Data Source in Query Mode
- URL:
http://<servername>:<portnumber>/bi/api/site/site1/v4.0/datasources/
- Method:
POST
- Content Type:
application/json
- Authorization:
Bearer <token>
Request Body Schema
{
"Name": "string",
"Type": "string",
"Description": "",
"Connection": {
"Servername": "string",
"Port": "string",
"Username": "string",
"Password": "string",
"Database": "string",
"Query": "string",
"ExpressionInfo": [
{
"Expressionname": "string",
"Displaytext": "string"
}
]
}
}
References
Please note that the URLs provided are examples and should be replaced with the actual service endpoints. The port number and site path should also be adjusted according to your specific Bold BI server configuration.