Forum Discussion
Migrating workspaces and reports between two tenants.
- 3 years ago
Ammm no. But if you read the doc of the library it shows how to login, get token and use the rest api categories (in this case reports and imports).
You should create two tokens, one for each tenant. Then create object reports to export it from a token from tenant 1. Create the second object imports to publish it from token from tenant 2.
Inside those objects there are two requests to use in order to get this:
# Get a json response from the API response_with_pbix = export_report_in_group(workspace_id_origin, report_id) # The response has a "Content" attribute with the pbix file. You can use that to import in the new tenant simple_import_pbix_as_parameter(workspace_id, fileContent, datasetDisplayName)I hope that helps you understand the idea, it can also be done with requests that specify the local folder to save the file from tenant 1 and the local folder to import the file to tenant 2.
Great, do you have some example code where you exported reports to a variable and published them again?
Ammm no. But if you read the doc of the library it shows how to login, get token and use the rest api categories (in this case reports and imports).
You should create two tokens, one for each tenant. Then create object reports to export it from a token from tenant 1. Create the second object imports to publish it from token from tenant 2.
Inside those objects there are two requests to use in order to get this:
# Get a json response from the API
response_with_pbix = export_report_in_group(workspace_id_origin, report_id)
# The response has a "Content" attribute with the pbix file. You can use that to import in the new tenant
simple_import_pbix_as_parameter(workspace_id, fileContent, datasetDisplayName)
I hope that helps you understand the idea, it can also be done with requests that specify the local folder to save the file from tenant 1 and the local folder to import the file to tenant 2.