Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
RamyaRascher
Regular Visitor

Difference between via Api and via Enhanced Api

I am trying to deploy reports to workspaces using PowerShell scripts. Our organization uses the same pbix file skeleton and changes to client datasource in their respective workspaces. We achieve this by connecting first to an empty database and once published, change to client specific data sources and credentials. We also have the Incremental refresh set up for these reports. 

 

The flow of report deployment goes as follow, 

publish the report with empty db --> full refresh to create partitions --> "ClearValues" refresh to clear values in partition --> update datasource and credentials --> transactional refresh. 

 

I do this to clear the values in partitions and fill them with client data for the created partitions. 

 

The challenge is the API call I make to clear values in the partition is not working as expected. The call is made successfully but it is not clearing the values. Hence, when the last call is made, correct data is not filled in the existing partitions. 

 

I also noticed that refresh types for these calls are Via Api instead of Via Enhanced Api. 

 

Has anyone else experienced this? Does anyone maybe have a more elegant solution?

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @RamyaRascher ,

The Power BI REST API is a REST-based API that provides programmatic access to Dashboard resources such as Datasets, Tables, and Rows in Power BI. The Enhanced API is a new version of the Power BI REST API that provides additional functionality and performance improvements over the previous version. The Enhanced API is currently in preview and is available to use alongside the existing Power BI REST API.

 

To clear the data in the partitions of a Power BI dataset using PowerShell, you can use the Invoke-RestMethod cmdlet in PowerShell to call the Power BI REST API and send a DELETE request to the partitions endpoint of the dataset. Here is an example PowerShell script that clears the data in the partitions of a dataset:

$token = Get-PowerBIAccessToken
$authHeader = @{ 'Authorization' = "Bearer $token" }
$datasetId = '<your dataset ID>'
$partitionsEndpoint = "https://api.powerbi.com/v1.0/myorg/datasets/$datasetId/partitions"
Invoke-RestMethod -Uri $partitionsEndpoint -Headers $authHeader -Method DELETE

This script first gets an access token for the Power BI REST API using the Get-PowerBIAccessToken cmdlet. It then constructs an authorization header using the access token. The script then specifies the dataset ID and constructs the partitions endpoint URL. Finally, the script sends a DELETE request to the partitions endpoint using the Invoke-RestMethod cmdlet to clear the data in the partitions of the dataset。

Best Regards

View solution in original post

1 REPLY 1
Anonymous
Not applicable

Hi @RamyaRascher ,

The Power BI REST API is a REST-based API that provides programmatic access to Dashboard resources such as Datasets, Tables, and Rows in Power BI. The Enhanced API is a new version of the Power BI REST API that provides additional functionality and performance improvements over the previous version. The Enhanced API is currently in preview and is available to use alongside the existing Power BI REST API.

 

To clear the data in the partitions of a Power BI dataset using PowerShell, you can use the Invoke-RestMethod cmdlet in PowerShell to call the Power BI REST API and send a DELETE request to the partitions endpoint of the dataset. Here is an example PowerShell script that clears the data in the partitions of a dataset:

$token = Get-PowerBIAccessToken
$authHeader = @{ 'Authorization' = "Bearer $token" }
$datasetId = '<your dataset ID>'
$partitionsEndpoint = "https://api.powerbi.com/v1.0/myorg/datasets/$datasetId/partitions"
Invoke-RestMethod -Uri $partitionsEndpoint -Headers $authHeader -Method DELETE

This script first gets an access token for the Power BI REST API using the Get-PowerBIAccessToken cmdlet. It then constructs an authorization header using the access token. The script then specifies the dataset ID and constructs the partitions endpoint URL. Finally, the script sends a DELETE request to the partitions endpoint using the Invoke-RestMethod cmdlet to clear the data in the partitions of the dataset。

Best Regards

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.