Forum Discussion

prabavathym's avatar
prabavathym
Helper II
1 year ago

How to Retrieve Refresh History for Datamarts? Need Help with REST API

Hi Community,

I am working on a task that involves creating tables in a Power BI Datamart and logging their refresh activity using the REST API. The goal is to monitor refreshes and cancel any that exceed 5 minutes.

To capture the refresh history, I tried using the Service Principal method with the following REST APIs:

  1. Get Refresh History
  2. Get Refresh History in Group

These APIs worked perfectly for retrieving refresh history for the Semantic Model (dataset). However, when I attempted to use the same APIs for the Datamart, I received the following error message:

"Invalid dataset. This API can only be called on a Model-based dataset."

This leads me to believe that the Datamart is not supported by these APIs.

My Questions:

  1. Is there any other REST API or method available to capture the refresh history for a Power BI Datamart?
  2. Are there alternative approaches or suggestions to log and monitor refresh activity for Datamarts?
  3. I am specifically looking for a REST API solution, but I’m open to other ideas if necessary.

Any guidance or ideas would be greatly appreciated. Thank you!

2 Replies

  • Hi prabavathym 

    As per me:

    1. REST API for Datamart Refresh History: Currently, there is no specific REST API for directly capturing refresh history for Power BI Datamarts, as the existing APIs like Get Refresh History only work for model-based datasets.

    2. Alternative Approach: Use Power BI Activity Log via the Microsoft 365 Admin Center or Audit Logs to monitor Datamart refresh activities. You can extract these logs programmatically using the Microsoft Graph API or PowerShell.

    3. Logging and Monitoring: Set up an external logging mechanism to capture refresh triggers and completion statuses by integrating Power Automate or similar tools that track refresh activity through the Power BI API triggers or email notifications.

    No direct REST API exists yet, so using audit logs or automation tools is the best alternative.

     

    Did I answer your question? Mark my post as a solution, this will help others!

    If my response(s) assisted you in any way, don't forget to drop me a "Kudos" 🙂

    Kind Regards,
    Poojara
    Data Analyst | MSBI Developer | Power BI Consultant
    Please Subscribe my YouTube for Beginners/Advance Concepts: https://youtube.com/@biconcepts?si=04iw9SYI2HN80HKS 

    • prabavathym's avatar
      prabavathym
      Helper II

      Thank you for the helpful insights. Poojara_D12

      Your suggestion about using the Power BI Activity Log through the Microsoft 365 Admin Center or Audit Logs is a great alternative. However, in our specific requirement, we are focusing on a REST API solution to capture refresh history for Datamarts. Since there is currently no direct REST API available for this, I’m exploring other methods like using Microsoft Graph API or PowerShell to extract the logs programmatically.

      Additionally, the idea of leveraging Power Automate or similar automation tools to track refresh activities via API calls or email notifications could be useful, but we are primarily looking for a REST API approach to stay within the Power BI API ecosystem.

      Thanks again for your valuable input, and I’ll keep exploring the available options!