<?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 Re: Uploading a PBIX file using the import API in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/Uploading-a-PBIX-file-using-the-import-API/m-p/358956#M10685</link>
    <description>&lt;P&gt;I figured out what I did wrong. Apparently you need a datasetDisplayName which is part of the url.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Therefore this problem can be solved by appending the datasetDisplayName field to the url like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;url: 'https://api.powerbi.com/v1.0/myorg/groups/' + groupId + '/imports?datasetDisplayName=' + reportName&lt;/PRE&gt;</description>
    <pubDate>Thu, 15 Feb 2018 16:09:21 GMT</pubDate>
    <dc:creator>fgroenev</dc:creator>
    <dc:date>2018-02-15T16:09:21Z</dc:date>
    <item>
      <title>Uploading a PBIX file using the import API</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Uploading-a-PBIX-file-using-the-import-API/m-p/357386#M10637</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am stuck trying to programmatically upload a .pbix file using the import API, making use of the request-promise library which is imported as "rp" here.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am currently trying the following (in Node.js), which results in HTTP error 400:&lt;/P&gt;&lt;PRE&gt;let url = 'https://api.powerbi.com/v1.0/myorg/groups/' + groupId + '/imports';
		
let options = {
	method: 'POST',
	headers: {
		'Content-Type': 'multipart/form-data',
		'authorization': 'Bearer ' + accessToken
	},
	body: fs.createReadStream(__dirname + '/Report.pbix'),
	url: 'https://api.powerbi.com/v1.0/myorg/groups/' + groupId + '/imports'
};

rp(options)
	.then(function (body) {
	console.log('success! ', body);
})
	.catch(function (err) {
	console.log('error', err);
});&lt;/PRE&gt;&lt;P&gt;I also haven't had any success uploading the file using postman, where I have tried it with and without having set the Content-Type header.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What&amp;nbsp;could I be doing wrong? What headers are necessary to upload this file and make a proper request?&lt;/P&gt;</description>
      <pubDate>Thu, 15 Feb 2018 10:06:59 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Uploading-a-PBIX-file-using-the-import-API/m-p/357386#M10637</guid>
      <dc:creator>fgroenev</dc:creator>
      <dc:date>2018-02-15T10:06:59Z</dc:date>
    </item>
    <item>
      <title>Re: Uploading a PBIX file using the import API</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Uploading-a-PBIX-file-using-the-import-API/m-p/358956#M10685</link>
      <description>&lt;P&gt;I figured out what I did wrong. Apparently you need a datasetDisplayName which is part of the url.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Therefore this problem can be solved by appending the datasetDisplayName field to the url like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;url: 'https://api.powerbi.com/v1.0/myorg/groups/' + groupId + '/imports?datasetDisplayName=' + reportName&lt;/PRE&gt;</description>
      <pubDate>Thu, 15 Feb 2018 16:09:21 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Uploading-a-PBIX-file-using-the-import-API/m-p/358956#M10685</guid>
      <dc:creator>fgroenev</dc:creator>
      <dc:date>2018-02-15T16:09:21Z</dc:date>
    </item>
    <item>
      <title>Re: Uploading a PBIX file using the import API</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Uploading-a-PBIX-file-using-the-import-API/m-p/933321#M22319</link>
      <description>&lt;P&gt;This is Python equivalant to upload a .pbix local file into PowerBI server&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;import &lt;/SPAN&gt;requests&lt;BR /&gt;&lt;SPAN&gt;from &lt;/SPAN&gt;requests_toolbelt.multipart.encoder &lt;SPAN&gt;import &lt;/SPAN&gt;MultipartEncoder&lt;BR /&gt;&lt;BR /&gt;groupId = &lt;SPAN&gt;"your workspace ID"&lt;BR /&gt;&lt;/SPAN&gt;reportName = &lt;SPAN&gt;"reportName that you choose to appear on the server"&lt;BR /&gt;&lt;/SPAN&gt;accessToken = &lt;SPAN&gt;"xx&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;url = &lt;SPAN&gt;'https://api.powerbi.com/v1.0/myorg/groups/' &lt;/SPAN&gt;+ groupId + &lt;SPAN&gt;'/imports?datasetDisplayName=' &lt;/SPAN&gt;+ reportName&lt;BR /&gt;headers = {&lt;BR /&gt;    &lt;SPAN&gt;'Content-Type'&lt;/SPAN&gt;: &lt;SPAN&gt;'multipart/form-data'&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;BR /&gt;&lt;/SPAN&gt;    &lt;SPAN&gt;'authorization'&lt;/SPAN&gt;: &lt;SPAN&gt;'Bearer ' &lt;/SPAN&gt;+ accessToken&lt;BR /&gt;}&lt;BR /&gt;file_location = &lt;SPAN&gt;'/xx.pbix'&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;# you need this dictionary to convert a binary file into form-data format&lt;BR /&gt;# None here means we skip the filename and file content is important &lt;BR /&gt;&lt;/SPAN&gt;files = {&lt;SPAN&gt;'value'&lt;/SPAN&gt;: (&lt;SPAN&gt;None, &lt;/SPAN&gt;&lt;SPAN&gt;open&lt;/SPAN&gt;(file_location&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;'rb'&lt;/SPAN&gt;)&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;'multipart/form-data'&lt;/SPAN&gt;)}&lt;BR /&gt;&lt;BR /&gt;mp_encoder = MultipartEncoder(&lt;SPAN&gt;fields&lt;/SPAN&gt;=files)&lt;BR /&gt;&lt;BR /&gt;r = requests.post(&lt;BR /&gt;    &lt;SPAN&gt;url&lt;/SPAN&gt;=url&lt;SPAN&gt;,&lt;BR /&gt;&lt;/SPAN&gt;    &lt;SPAN&gt;data&lt;/SPAN&gt;=mp_encoder&lt;SPAN&gt;,  &lt;/SPAN&gt;&lt;SPAN&gt;# The MultipartEncoder is posted as data, don't use files=...!&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;    # The MultipartEncoder provides the content-type header with the boundary:&lt;BR /&gt;&lt;/SPAN&gt;    &lt;SPAN&gt;headers&lt;/SPAN&gt;=headers&lt;BR /&gt;)&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 14 Feb 2020 13:44:14 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Uploading-a-PBIX-file-using-the-import-API/m-p/933321#M22319</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-02-14T13:44:14Z</dc:date>
    </item>
  </channel>
</rss>

