Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
rogersmj
Frequent Visitor

Trouble with import API

I am trying to develop an Azure Logic App to automate some very painful aspects of our deployment/customer provisioning processes. Part of that process involves uploading a reference PBIX to the Power BI service (and subsequently setting parameters/gateway settings).

 

I have a PBIX file in Azure blob storage, and I read the contents of it using the Get Blob Content action. When I call the Imports API (using a basic Logic Apps HTTP action), I am getting a 400 (bad request) response. Initially I was simply getting Unknown Error as the response, but now at least I have reached the point where I am getting a MultiPartMimeStreamFormatException:

 

{
  "error": {
    "code": "MultiPartMimeStreamFormatException",
    "pbi.error": {
      "code": "MultiPartMimeStreamFormatException",
      "parameters": {},
      "details": [],
      "exceptionCulprit": 1
    }
  }
}

 

However I can't figure out what this exception means or why it is happening. I have pored over all the docs -- which are very thin -- and this blog post from more than three years ago announcing the beta of this API, and I have reviewed the official W3 specs for submitting a file as multipart form data. My raw submission (below) appears to match the format described in that blog post.

 

Here's my request:

 

{
    "uri": "https://api.powerbi.com/v1.0/myorg/groups/98b09eb1-7dfc-4eda-9191-2e2a1e018735/imports?datasetDisplayName=TestImport",
    "method": "POST",
    "headers": {
        "Content-Type": "multipart/form-data; boundary=----------------abcdefg12345"
    },
    "authentication": {
        "value": "*sanitized*",
        "type": "Raw"
    },
    "body": "----------------abcdefg12345\nContent-Disposition: form-data; name=\"files\"; filename=\"MasterTemplate.pbix\"\nContent-Type: application/octet-stream\n\nPK\u0003\u0004\u0014\u0000\u0000\u0000\b\u0000Mu1My#\u0004�\n\u0000\u0000\u0000\b\u0000\u0000\u0000\u0007\u0000\u001c\u0000Version <TRUNCATED>"
}
1 REPLY 1
jbrandt
Advocate I
Advocate I

Hi there, did you ever figure this out?

Helpful resources

Announcements
PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.