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
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
firstImage

New Ranks and Rank Icons in April

Read the announcement for more information!

firstImage

Better Together Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

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

sixthImage

Community Summit North America

The top training and networking event across the globe for Microsoft Business Applications

Users online (9,507)