Reply
Frequent Visitor
Posts: 2
Registered: ‎03-12-2018

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>"
}
Frequent Visitor
Posts: 21
Registered: ‎12-15-2016

Re: Trouble with import API

Hi there, did you ever figure this out?