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

Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.

Reply

Imports pbix by using Create Temporary Upload location but error in "Imports - Post impost api"

I am using "Imports - Create Temporary Upload Location In Group" to import pbix to workspace having premium capacity.

$uri = "https://api.powerbi.com/v1.0/myorg/groups/XXXXXXX/imports/createTemporaryUploadLocation"

$tulResponse =Invoke-RestMethod -Uri $uri –Headers $auth_header –Method POST
  $tulResponse return  url , expiration ,and odata.context successfully .

$temp_path ="local path of Pbix "

$httpClient = New-Object System.Net.Http.Httpclient $httpClientHandler
$HttpClient.DefaultRequestHeaders.Add("x-ms-blob-type", "BlockBlob");
$packageFileStream = New-Object System.IO.FileStream @($temp_path, [System.IO.FileMode]::Open)
$contentDispositionHeaderValue = New-Object System.Net.Http.Headers.ContentDispositionHeaderValue "form-data"
$contentDispositionHeaderValue.Name = "<< file name>>"
$contentDispositionHeaderValue.FileName = "<<filename.pbix>>"
$streamContent = New-Object System.Net.Http.StreamContent $packageFileStream
$streamContent.Headers.ContentDisposition = $contentDispositionHeaderValue
$content = New-Object System.Net.Http.MultipartFormDataContent
$content.Add($streamContent)

$response1 = $httpClient.PutAsync($tulResponse.url, $content).Result

 

response1 return s

----

Version : 1.1
Content : System.Net.Http.StreamContent
StatusCode : Created
ReasonPhrase : Created
Headers : {[x-ms-request-id, System.String[]], [x-ms-version, System.String[]], [x-ms-request-server-encrypted, System.String[]], [Date, System.String[]]...}
RequestMessage : Method: PUT, RequestUri: 'https://XXxxxxxxxxxx.blob.core.windows.net/xxxxxx/yyyyyyy/Import/zzzz?sv=2015-12-11&sr=b&sig=ccccccc...',
Version: 1.1, Content: System.Net.Http.MultipartFormDataContent, Headers:
{
x-ms-blob-type: BlockBlob
Content-Type: multipart/form-data; boundary="xxxxxxxxx"
Content-Length: 1091275
}
IsSuccessStatusCode : True

till then all are good 

if($response1.IsSuccessStatusCode)
{

$bodypost = @{
'fileUrl' = $tulResponse.url
}
$uripost = "https://api.powerbi.com/v1.0/myorg/groups/xxxxx/imports?datasetDisplayName=<<filename>>&nameConflict..."
$respose2 =Invoke-RestMethod -Uri $uripost -Method POST -Body $bodypost -Headers $auth_header -ContentType 'multipart/form-data'

}

last line throw error 

Invoke-RestMethod : {"error":{"code":"UnknownError","pbi.error":{"code":"UnknownError","parameters":{},"details":[],"exceptionCulprit":1}}}


Please help me out !!  what I missed 

Thanks in advance 
Paritosh

 

7 REPLIES 7
PrakashArchunan
Frequent Visitor

Right now, I am working on this API. I can create temporary blob storage , but by using that Url I can't upload my greater than 1GB report PBIX file.

I don't know how to resolve this problem, Can you help me to sort out this problem?

 

PrakashArchunan
Frequent Visitor

Can you please help with me for this API?

Waiting for a solution 

TIA

Anyone  please share Request & Response headers/bodies  of all three APIs 
1. /imports/createTemporaryUploadLocation"
2. Upload pbix 
3. /imports?datasetDisplayName=  with body  'fileUrl' = $tulResponse.url

TIA

V-lianl-msft
Community Support
Community Support

Hi @paritoshmishra ,

 

Unfortunately It's hard for me to know the problem if I don't go through your whole process, you have to know if the file exists in the destination directory before you make the call.

 

Best Regards,
Liang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi Liang 
Pbix file store in my loacal system i.e $temp_path ="local path of Pbix "
My pbix size is 1.2 MB .Is it size of file matter ? Is tempoaryloactionupload is only works on file of size is greater then 1 GB ??
Please help me out 

TIA

Anonymous
Not applicable

Did you find a solution?

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.