cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

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?

1 ACCEPTED SOLUTION

Accepted Solutions
mwegener
Helper II
Helper II
8 REPLIES 8
Anonymous
Not applicable

flow.PNG

 

Hi @Anonymous,

 

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.

Anonymous
Not applicable

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

Anonymous
Not applicable

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................"}

 

Hi @Anonymous,

 

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.

rG-tom
Regular Visitor

Hi @Anonymous 

 

Did you ever find a solution to this? I think I am trying to do exactly the same thing, and failing. Miserably.

 

https://community.powerbi.com/t5/Service/PowerBI-REST-API-Export-and-then-Import-in-Flow-Power-Automate/m-p/1055175#M94271 

 

Thanks,

 

Tom.

PowerDAX
Frequent Visitor

@rG-tom  unfortunately not - couldnt reach the right people @ microsoft

 

if you make progress let me know - and i will do the same

mwegener
Helper II
Helper II

Helpful resources

Announcements
Process Advisor

Introducing Process Advisor

Check out the new Process Advisor community forum board!

MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Users online (25,670)