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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
matvi
Frequent Visitor

REST API Usage: Reports - Update Report Content vs Clone vs Import

Hi, 

I'm writing a program to copy a workspace content to another one using the REST API. I've looked at the tutorial by Sirui Sun, but his example doesn't work if there are already reports in the target workspace.  

I see that there is 3 different ways of creating/updating a report and some documentation comparing each approach would be very appreciated. My understanding is:

1) Export and import the pbix: This can be used to create or update a report. It's the best option to create the datasets. The downside is that you have to download and upload everything so very unefficient. 

2) Clone report: From my tests, this will create a new report each time, so it can't be used for updating. It that true?

3) UpdateReportContent: I looked at the documentation and it doesn't really say much. My understanding is that, to update a report based on an existing one, this is the way to go. But in the request definition, there's a sourceType. What the **** is a sourceType. I've seen some example putting sourceType="ExistingReport", but what does that do and what are the other options?

 

Thanks 

Mathieu

 

2 REPLIES 2
TedPattison
Employee
Employee

I wrote a c# console application a while back to clone app workspace content. It is still a work in progress but it will help you get started.

 

Here is the approach I am using 

  1. Export/import all the PBIX projects you have created with Power BI Desktop. However, you must filter out reports that have been created in the browser or reports that are not paired with a dataset in a single import.
  2. Clone all dashboards and thier tiles (my code shows how to do this)
  3. Clone reports that were not cloned by export/import in step #1 (my code does not contain this functionality yet)

 

Here is the code which you can use as a starting point.

 

https://github.com/CriticalPathTraining/PBD365/blob/master/Modules/07_PBIRestApi/Demo/ClonePowerBiWo...

Thanks for your answer. I did something similar in Python. The main difference is that I only exported/imported pbix for reports defining datasets. I don't like that download/upload thing so for the left reports, I cloned the new ones and updated existing ones.

 

I was wondering how you handle the Azure Usage Metric report? 

Also, I see that you have some code to update the datasource credentials. Have you faced the issue of ownership? I wrote a method to take the ownership of a dataset before changing the credentials but is there a way of doing it without being the owner? I don't want my "service account" to be the owner of all workspaces....

 

Thanks, 

Mathieu

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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