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

The Power BI Data Visualization World Championships is back! It's time to submit your entry. Live now!

Reply
Anonymous
Not applicable

RDL import via API

I am trying to work out what the basic Powershell API call is to import an RDL file to a workspace (.pbix works fine). I have seen several posts on this, none of them using Invoke-PowerBIRestMethod and none of them working. The error reporting via this API or via standard Invoke-RestMethod just returns blank 400 errors with no more information and nothing in the error stream and so I'm reduced to endless trial and error with no real information to go on. Here is an example (I have tried countless variants of this and this is just an example that returns a 400 error). I have tried every content-type, Url format etc. I can think of with no effect - just a blank 400 error. I am signed in and can run many other API calls without problem, including uploading .pbix files. Does anyone have an example of this working?

 

  $encoding = [System.Text.Encoding]::GetEncoding("iso-8859-1")
  $fileBytes = [System.IO.File]::ReadAllBytes($rdlfile)
  $boundary = [System.Guid]::NewGuid().ToString()
  $filename = Split-Path $rdlfile -Leaf
  $bodyt = @'
--{0}
Content-Disposition: form-data; name="fileData"; filename="{1}"
Content-Type: application/rdl

{2}
--{0}--

'@
  $body = $bodyt -f $boundary, $fileName, $encoding.GetString($fileBytes)

  try {
    $response = Invoke-PowerBIRestMethod -Url "groups/$wkspid/imports?nameConflict=$conflict" -Method Post -ContentType "multipart/form-data" -Body $body -Organization $tenantid
  }
  catch {
    Resolve-PowerBIError -Last
  }
 

 

4 REPLIES 4
phoenixdatawork
Regular Visitor

Was there ever a resolution here?

Anonymous
Not applicable

Did you get a resolution for the RDL import?

Icey
Community Support
Community Support

Hi @Anonymous ,

 

Hope these posts would help you: 

Unable to call imports endpoint;

Upload RDL file(s) to Power BI via API.

 

 

Best Regards,

Icey

 

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

Anonymous
Not applicable

Unfortunatley, I tried both of those and neither work - the first one is about uploading .pbix, which I have no problem with, and the second one just gives me the errors I mentioned, nomatter what I tweak.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! It's time to submit your entry.

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 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.