<?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 Problem updating Excel file with API REST in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/Problem-updating-Excel-file-with-API-REST/m-p/2454201#M35509</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to upload an Excel/CSV file on an on-premise PBI portal using the API REST.&lt;/P&gt;&lt;P&gt;I'm able to upload a new file, but cannot succeed in overwriting it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I use On-Premise Power BI Report Server&amp;nbsp;&lt;SPAN class=""&gt;Version&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class=""&gt;1.8.7485.35104&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class=""&gt;(May 2020).&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;Is there any limitation on API REST with the On-Premise version?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I did some tests using the PowerShell exemple, and the documentation on the SwaggerHub.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This PS code works well for a new file:&lt;/P&gt;&lt;P class="lia-indent-padding-left-30px"&gt;$ReportPortalUri = '&lt;EM&gt;myreportportal&lt;/EM&gt;'&lt;BR /&gt;$catalogItemsUri = $ReportPortalUri + "/api/v2.0/ExcelWorkbooks"&lt;BR /&gt;$uploadItemPath = '&lt;EM&gt;myfile&lt;/EM&gt;'&lt;/P&gt;&lt;P class="lia-indent-padding-left-30px"&gt;$bytes = [System.IO.File]::ReadAllBytes($uploadItemPath)&lt;BR /&gt;$payload = @{&lt;BR /&gt;"@odata.type" = "#Model.ExcelWorkbook";&lt;BR /&gt;"Content" = [System.Convert]::ToBase64String($bytes);&lt;BR /&gt;"ContentType"="";&lt;BR /&gt;"Name" = '&lt;EM&gt;myfilename&lt;/EM&gt;';&lt;BR /&gt;"Path" = '&lt;EM&gt;myfilepath&lt;/EM&gt;';&lt;BR /&gt;} | ConvertTo-Json&lt;BR /&gt;Invoke-WebRequest -Uri $catalogItemsUri -Method Post -Body $payload -ContentType "application/json" -UseDefaultCredentials&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Then, I did some tests using the PATCH method and the GUID of the file.&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;$catalogItemsUri = $ReportPortalUri + "/api/v2.0/ExcelWorkbooks" + "(&lt;EM&gt;myguid&lt;/EM&gt;)"&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;Invoke-RestMethod -Uri $catalogItemsUri -Method Patch -Body $payload -ContentType 'application/json' -UseDefaultCredentials -UseBasicParsing -Verbose&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This works when I use simple attributes, such as&amp;nbsp;"Description" in the $payload&lt;/P&gt;&lt;P&gt;But this does not work when I use the "Content" attribute, the same way as for a new file : I got error "&lt;STRONG&gt;System.InvalidOperationException: Nullable object must have a value&lt;/STRONG&gt;". What am I missing here?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I also did some tests using the POST method on&amp;nbsp;Model.Upload function with&amp;nbsp;multipart/form-data content type.&lt;/P&gt;&lt;P&gt;But I got error "&lt;STRONG&gt;Unsupported Media Type&lt;/STRONG&gt;".&amp;nbsp;What am I missing here?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any exemple on how to use the Model.Upload function?&lt;/P&gt;&lt;P&gt;Any feedback on using the API REST with a On-Premise version?&lt;/P&gt;</description>
    <pubDate>Wed, 13 Apr 2022 07:37:52 GMT</pubDate>
    <dc:creator>jerome_dal</dc:creator>
    <dc:date>2022-04-13T07:37:52Z</dc:date>
    <item>
      <title>Problem updating Excel file with API REST</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Problem-updating-Excel-file-with-API-REST/m-p/2454201#M35509</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to upload an Excel/CSV file on an on-premise PBI portal using the API REST.&lt;/P&gt;&lt;P&gt;I'm able to upload a new file, but cannot succeed in overwriting it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I use On-Premise Power BI Report Server&amp;nbsp;&lt;SPAN class=""&gt;Version&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class=""&gt;1.8.7485.35104&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class=""&gt;(May 2020).&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;Is there any limitation on API REST with the On-Premise version?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I did some tests using the PowerShell exemple, and the documentation on the SwaggerHub.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This PS code works well for a new file:&lt;/P&gt;&lt;P class="lia-indent-padding-left-30px"&gt;$ReportPortalUri = '&lt;EM&gt;myreportportal&lt;/EM&gt;'&lt;BR /&gt;$catalogItemsUri = $ReportPortalUri + "/api/v2.0/ExcelWorkbooks"&lt;BR /&gt;$uploadItemPath = '&lt;EM&gt;myfile&lt;/EM&gt;'&lt;/P&gt;&lt;P class="lia-indent-padding-left-30px"&gt;$bytes = [System.IO.File]::ReadAllBytes($uploadItemPath)&lt;BR /&gt;$payload = @{&lt;BR /&gt;"@odata.type" = "#Model.ExcelWorkbook";&lt;BR /&gt;"Content" = [System.Convert]::ToBase64String($bytes);&lt;BR /&gt;"ContentType"="";&lt;BR /&gt;"Name" = '&lt;EM&gt;myfilename&lt;/EM&gt;';&lt;BR /&gt;"Path" = '&lt;EM&gt;myfilepath&lt;/EM&gt;';&lt;BR /&gt;} | ConvertTo-Json&lt;BR /&gt;Invoke-WebRequest -Uri $catalogItemsUri -Method Post -Body $payload -ContentType "application/json" -UseDefaultCredentials&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Then, I did some tests using the PATCH method and the GUID of the file.&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;$catalogItemsUri = $ReportPortalUri + "/api/v2.0/ExcelWorkbooks" + "(&lt;EM&gt;myguid&lt;/EM&gt;)"&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;Invoke-RestMethod -Uri $catalogItemsUri -Method Patch -Body $payload -ContentType 'application/json' -UseDefaultCredentials -UseBasicParsing -Verbose&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This works when I use simple attributes, such as&amp;nbsp;"Description" in the $payload&lt;/P&gt;&lt;P&gt;But this does not work when I use the "Content" attribute, the same way as for a new file : I got error "&lt;STRONG&gt;System.InvalidOperationException: Nullable object must have a value&lt;/STRONG&gt;". What am I missing here?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I also did some tests using the POST method on&amp;nbsp;Model.Upload function with&amp;nbsp;multipart/form-data content type.&lt;/P&gt;&lt;P&gt;But I got error "&lt;STRONG&gt;Unsupported Media Type&lt;/STRONG&gt;".&amp;nbsp;What am I missing here?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any exemple on how to use the Model.Upload function?&lt;/P&gt;&lt;P&gt;Any feedback on using the API REST with a On-Premise version?&lt;/P&gt;</description>
      <pubDate>Wed, 13 Apr 2022 07:37:52 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Problem-updating-Excel-file-with-API-REST/m-p/2454201#M35509</guid>
      <dc:creator>jerome_dal</dc:creator>
      <dc:date>2022-04-13T07:37:52Z</dc:date>
    </item>
    <item>
      <title>Re: Problem updating Excel file with API REST</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Problem-updating-Excel-file-with-API-REST/m-p/2461082#M35584</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/311342"&gt;@jerome_dal&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;According to &lt;A href="https://docs.microsoft.com/en-us/rest/api/power-bi/imports/post-import-in-group" target="_self"&gt;the offical blog&lt;/A&gt;, I think Power BI only support us to import .xlsx file from OneDrive for Business.&lt;/P&gt;
&lt;P&gt;Supported content:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="RicoZhou_0-1650268055701.png" style="width: 400px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/701017iB742F31E604B30E3/image-size/medium?v=v2&amp;amp;px=400" role="button" title="RicoZhou_0-1650268055701.png" alt="RicoZhou_0-1650268055701.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;To import an .xlsx file from OneDrive for Business, include the content type&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;application/json&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;in the request headers. Include&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://docs.microsoft.com/en-us/rest/api/power-bi/imports/post-import-in-group#importinfo" data-linktype="absolute-path" target="_blank"&gt;ImportInfo&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;with&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;CODE&gt;filePath&lt;/CODE&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;set to the .xlsx file path in the request body.&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;BR /&gt;Rico Zhou&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 18 Apr 2022 07:48:36 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Problem-updating-Excel-file-with-API-REST/m-p/2461082#M35584</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-04-18T07:48:36Z</dc:date>
    </item>
    <item>
      <title>Re: Problem updating Excel file with API REST</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Problem-updating-Excel-file-with-API-REST/m-p/2493540#M35899</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;It's possible to import Excel/CSV files with the On Premise version. There was a bug with the "&lt;SPAN&gt;May 2020" version preventing the upload with overwrite.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I tested with "January 2022" version and it is ok now for the PATCH method on&amp;nbsp;ExcelWorkbooks(guid).&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;But I still have problem using the POST method on&amp;nbsp;ExcelWorkbooks(guid)/Model.Upload to handle with files larger than 25Mb. I get a "(415) Unsupported Media Type" from the report server.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Any idea?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Does anyone have an exemple of code using method ExcelWorkbooks(guid)/Model.Upload?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 04 May 2022 13:28:58 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Problem-updating-Excel-file-with-API-REST/m-p/2493540#M35899</guid>
      <dc:creator>jerome_dal</dc:creator>
      <dc:date>2022-05-04T13:28:58Z</dc:date>
    </item>
  </channel>
</rss>

