This guide outlines the steps required to consume a Chateau’s API and integrate the data into Power BI for advanced analytics and reporting.
Generating an API Token
To securely access Chateau’s API, you first need to generate an API token. This token will authenticate your requests.
- Navigate to the API Access Tokens page in Majordomo.
- Click on the Add API Access Token button.
- Add a token description and select the Chateau database you would like to access.
- Click Create Token.
- Save the generated token securely, as you will need it to make API requests.
- Note: Keep your API token confidential to prevent unauthorized access to your data.
Getting Data in Power BI
Once you have your API token, you can use it to import data into Power BI.
For all non-limited API Calls:
- Open Power BI Desktop.
- Select “Get Data” > “Web” as the source.
- Enter the API endpoint URL, and use the “Advanced” settings to add headers for authentication.
- Note: For a list of currently available APIs, visit https://api.ldartools.com/swagger/index.html.
- In the Headers section, enter “Authorization” for the key and Bearer “<Your API Token>” for the value.
- Load the data into Power BI for analysis.
For all limited API Calls:
Some API calls enforce a limit to the number of records that can be requested at once (notably Inspections and Components). For these API calls we need to request data in a loop in order to get what we want if the number of records is above the upper limit (10000).
- Open Power BI Desktop.
- Select “Get Data” > “Blank Query” as the source.
- Download this txt file to acquire the script shown in the screenshot below, enter the script in the Advanced Editor and make modifications to the API token and the URL depending on your needs.
- Note: This may take some time depending on the size of your database.
- Note: This may take some time depending on the size of your database.
- Load the data into Power BI for analysis.
Example Report
After loading your data into Power BI, you can create reports to visualize and analyze the data.
- Select the data fields to visualize.
- Customize the report with charts, filters, and slicers as needed.
- Download the Example DempAPI.pbix file.
Best Practices
When consuming Chateau’s API and using the data in Power BI, consider the following best practices to ensure efficient and secure data handling:
-
Secure Your API Token: Always keep your API token secure and avoid sharing it in your reports or with unauthorized individuals.
-
Minimize Data Load: Only request the data you need by using API parameters to filter data on the server side. This reduces network traffic and speeds up data retrieval.
-
Refresh Data Responsibly: Set up scheduled refreshes in Power BI at a frequency that balances up-to-date data with server load considerations. Avoid overloading the API server with too frequent requests.
We recommend no more than once a day.
-
Error Handling: Implement error handling in your Power BI queries to gracefully handle API downtimes or changes. Use Power BI’s built-in functions to retry failed requests or alert you to issues.
By following these instructions and best practices, you can quickly integrate Chateau’s API data into Power BI, enabling powerful data analysis and reporting capabilities.