<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Error: MultipartRequestBodyParseError in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/Error-MultipartRequestBodyParseError/m-p/3278937#M43040</link>
    <description>&lt;P&gt;Hello, so i am trying to upload files using POST Import API request. So far I have successfully uploaded a PBIX file to my workspace with the API call, but when i try and upload an XLSX file with the same function i get&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;{"error":{"code":"MultipartRequestBodyParseError","pbi.error":{"code":"MultipartRequestBodyParseError","parameters":{},"details":[]}}}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The function that i use to upload the file is:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;def import_file(token,datasetDisplayName,file):
    url = f"https://api.powerbi.com/v1.0/myorg/imports?datasetDisplayName={datasetDisplayName}"
    header = {
        "Authorization": f"Bearer {token}",
        "Content-type": "multipart/form-data"
    }
    payload = {
        "filePath": file,
    }
    r = requests.post(url, headers=header, files=payload)
    response = r
    print(response)
    print(response.text)

file_path = "test_file.xlsx"
file_contents = open("test_file.xlsx", "rb")
import_file(token,"Melbourne.xlsx", file_contents)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 12 Jun 2023 07:29:00 GMT</pubDate>
    <dc:creator>LukaP</dc:creator>
    <dc:date>2023-06-12T07:29:00Z</dc:date>
    <item>
      <title>Error: MultipartRequestBodyParseError</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Error-MultipartRequestBodyParseError/m-p/3278937#M43040</link>
      <description>&lt;P&gt;Hello, so i am trying to upload files using POST Import API request. So far I have successfully uploaded a PBIX file to my workspace with the API call, but when i try and upload an XLSX file with the same function i get&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;{"error":{"code":"MultipartRequestBodyParseError","pbi.error":{"code":"MultipartRequestBodyParseError","parameters":{},"details":[]}}}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The function that i use to upload the file is:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;def import_file(token,datasetDisplayName,file):
    url = f"https://api.powerbi.com/v1.0/myorg/imports?datasetDisplayName={datasetDisplayName}"
    header = {
        "Authorization": f"Bearer {token}",
        "Content-type": "multipart/form-data"
    }
    payload = {
        "filePath": file,
    }
    r = requests.post(url, headers=header, files=payload)
    response = r
    print(response)
    print(response.text)

file_path = "test_file.xlsx"
file_contents = open("test_file.xlsx", "rb")
import_file(token,"Melbourne.xlsx", file_contents)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 12 Jun 2023 07:29:00 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Error-MultipartRequestBodyParseError/m-p/3278937#M43040</guid>
      <dc:creator>LukaP</dc:creator>
      <dc:date>2023-06-12T07:29:00Z</dc:date>
    </item>
    <item>
      <title>Re: Error: MultipartRequestBodyParseError</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Error-MultipartRequestBodyParseError/m-p/3282677#M43067</link>
      <description>&lt;P&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif"&gt;Hi&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/574059"&gt;@LukaP&lt;/a&gt;&amp;nbsp;,&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif"&gt;Where did the file hosts? If it was store in sharepoint or onedrive online, please set the context-type to&amp;nbsp;'application/json'.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif"&gt;If you are work with a local file, I'd like to suggest you to use the absolute path instead to relative path to help requests correctly find the pending upload files.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif"&gt;&lt;A href="https://learn.microsoft.com/en-us/rest/api/power-bi/imports/post-import" target="_blank"&gt;Imports - Post Import - REST API (Power BI Power BI REST APIs) | Microsoft Learn&lt;/A&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif"&gt;Regards,&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif"&gt;Xiaoxin Sheng&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 14 Jun 2023 02:18:35 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Error-MultipartRequestBodyParseError/m-p/3282677#M43067</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-06-14T02:18:35Z</dc:date>
    </item>
    <item>
      <title>Re: Error: MultipartRequestBodyParseError</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Error-MultipartRequestBodyParseError/m-p/3283002#M43069</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;The files are on my local machine; i have tried using the aboslute path but the result is the same, I still get the "MultipartRequestBodyParseError".&lt;/P&gt;&lt;P&gt;I have also tried reading the entire file and trying to upload that variable, however nothing changed. I also tried switching content-type to "json" just to see if it works and then it gave me response code 400, without any errors this time&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Honestly, at this point i have no idea what is going wrong&lt;/P&gt;</description>
      <pubDate>Wed, 14 Jun 2023 06:40:41 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Error-MultipartRequestBodyParseError/m-p/3283002#M43069</guid>
      <dc:creator>LukaP</dc:creator>
      <dc:date>2023-06-14T06:40:41Z</dc:date>
    </item>
  </channel>
</rss>

