cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
adamharper
Level: Powered On

Microsoft Flow + Power BI API Custom Connector - Post Import in Group

I have a flow using the Power BI API (swagger) custom connector discussed here:  https://medium.com/@Konstantinos_Ioannou/refresh-powerbi-dataset-with-microsoft-flow-73836c727c33

 

I am creating a process to Export a pbix file from a workspace (https://docs.microsoft.com/en-us/rest/api/power-bi/reports/exportreportingroup) -- this is working -- and then import it into another workspace (https://docs.microsoft.com/en-us/rest/api/power-bi/imports/postimportingroup) -- not working.

 

The import action from the Power BI API swagger file calls for groupId, datasetDisplayName, importInfo, and nameConflict.

groupId = groupId of the workspace I want to import the pbix to

datasetDisplayName = dataset/report name I have exported

importInfo = NEED FORMAT

nameConflict = CreateOrOverwrite

 

I attempted just passing the content of the Export and that didn't work:  body('Export_pbix')['$content']

 

I attempted creating a file on SharePoint for the exported file, getting the file content from SharePoint, and passing that as the importInfo and that didn't work.

 

This document states, it is expecting the file as content-type = multipart/form-data (https://powerbi.microsoft.com/en-us/blog/upload-a-local-pbix-file-using-the-import-api/) - also stated 

  • To import a file, request Headers should include Content-Type: multipart/form-data with the file encoded as form data in the request body

I attempted converting the body content to base64 and that didn't work:  base64(body('Export_pbix')['$content'])

 

I think I need to format this section as JSON but I am not sure what the format should be. Does anyone know?

5 REPLIES 5
Highlighted
adamharper
Level: Powered On

Re: Microsoft Flow + Power BI API Custom Connector - Post Import in Group

flow.PNG

 

Community Support Team
Community Support Team

Re: Microsoft Flow + Power BI API Custom Connector - Post Import in Group

Hi @adamharper,

 

What's the body('Export_pbix')['$content'] look like? It's encode base64 or Json format?

And what's the error information report?

I can see you create the pbix file in the SharePoint, can it be opened normally? If it can be, you might have some wrong with the custom connector.

Best Regards,

Community Support Team _ Lin Tu

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

adamharper
Level: Powered On

Re: Microsoft Flow + Power BI API Custom Connector - Post Import in Group

no, it cannot be opened.....assuming I have to extract/encode somehow

adamharper
Level: Powered On

Re: Microsoft Flow + Power BI API Custom Connector - Post Import in Group

just realized I didnt answer the rest of the question......the export "click to download" looks like this (.......is just long bunch of letters) accessed from a url like:

 

https://prod-90.westus.logic.azure.com/workflows/<workflowid>/runs/<runid>/actions/Export_pbix/repetitions/000000/contents/ActionOutputs?api-version=2017-07-01&se=2019-08-17T02%3A00%3A00.0000000Z&sp=%2Fruns%<runid>%2Factions%2FExport_pbix%2Frepetitions%2F000000%2Fcontents%2FActionOutputs%2Fread&sv=1.0&sig=<sig>

{"statusCode":200,"headers":{"Pragma":"no-cache","Transfer-Encoding":"chunked","X-PowerBI-FileName":"Security %2D Work Cell.pbix","Strict-Transport-Security":"max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains","X-Frame-Options":"deny,deny","X-Content-Type-Options":"nosniff,nosniff","RequestId":"<requestid>","Access-Control-Expose-Headers":"RequestId","Cache-Control":"no-store, must-revalidate, no-cache","Date":"Fri, 16 Aug 2019 09:31:49 GMT","Content-Type":"application/zip","Content-Length":"11789015"},"body":{"$content-type":"application/zip","$content":"UEsDBBQAAAAIANFLEE8813PJCgAAAAgAAAAHABwAVmVyc2lvbiCiGAAooBQAAAAAAAAAAAAAAAAAAAAAAAAAAAAzZNBj................"}}

 the input to the import looks as such:

{"method":"post","queries":{"datasetDisplayName":"Security - Work Cell.pbix","nameConflict":"CreateOrOverwrite"},"path":"/v1.0/myorg/groups/<groupid>/imports","host":{"api":{"runtimeUrl":"https://flow-apim-msmanaged-na-westus2-01.azure-apim.net/apim/power.20bi.20api.5fa59b954ec8832683.5f642a394d082feff5"},"connection":{"name":"/providers/Microsoft.PowerApps/apis/shared_power.20bi.20api.5fa59b954ec8832683.5f642a394d082feff5/connections/<connectionid>"}},"authentication":{"scheme":"Key","parameter":"*sanitized*","type":"Raw"},"body":"UEsDBBQAAAAIANFLEE8813PJCgAAAAgAAAAHABwAVmVyc2lvbiCiGAAooBQAAAAAAAAAAAAAAAAAAAAAAAAAAAAzZNBj................"}

 

Community Support Team
Community Support Team

Re: Microsoft Flow + Power BI API Custom Connector - Post Import in Group

Hi @adamharper,

 

Ok, so you can add a Compose action to put the content into it, and check the output how it looks like.

 

Best Regards,

Community Support Team _ Lin Tu

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

firstImage

Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Kudoed Authors
Users Online
Currently online: 219 members 5,568 guests
Please welcome our newest community members: