Skip to main content

Notifications

Community site session details

Community site session details

Session Id : Wxi8MBqo+TAae1Ho59+KB3
Power Automate - Using Connectors
Answered

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

Like (0) ShareShare
ReportReport
Posted on 15 Aug 2019 16:24:49 by

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?

  • Verified answer
    Community Power Platform Member Profile Picture
    on 19 Jun 2020 at 10:56:41
    Re: Microsoft Flow + Power BI API Custom Connector - Post Import in Group

    Hi @Anonymous ,

     

    i found the solution.

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

     

  • PowerDAX Profile Picture
    7 on 30 Apr 2020 at 17:46:18
    Re: Microsoft Flow + Power BI API Custom Connector - Post Import in Group

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

     

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

  • rG-tom Profile Picture
    10 on 30 Apr 2020 at 17:43:07
    Re: Microsoft Flow + Power BI API Custom Connector - Post Import in Group

    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.

  • v-litu-msft Profile Picture
    on 19 Aug 2019 at 02:11:46
    Re: Microsoft Flow + Power BI API Custom Connector - Post Import in Group

    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.

  • Community Power Platform Member Profile Picture
    on 16 Aug 2019 at 22:13:12
    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 Power Platform Member Profile Picture
    on 16 Aug 2019 at 14:22:03
    Re: Microsoft Flow + Power BI API Custom Connector - Post Import in Group

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

  • v-litu-msft Profile Picture
    on 16 Aug 2019 at 06:33:00
    Re: Microsoft Flow + Power BI API Custom Connector - Post Import in Group

    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.

  • Community Power Platform Member Profile Picture
    on 15 Aug 2019 at 16:26:26
    Re: Microsoft Flow + Power BI API Custom Connector - Post Import in Group

    flow.PNG

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,731 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 66,075 Most Valuable Professional

Leaderboard

Featured topics