Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
I am having problems with the new SSRS REST API, in particular relinking uploaded reports to their datasources. Microsoft have confirmed that the API doc as published is not correct in that the PUT on report datasources should take an array of datasources, not just one datasource but I still can't get it to do anything other than return 400 errors every time, no matter what I try. Nothing useful in the logs either. Here is a minimal snippet in Powershell where I simply get the datasources, modify the path and try to PUT the changes datasources back again. The PUT always gets a 400 error.
$ret = Invoke-RESTMethod -Uri "$restroot/Reports(Path='/$replib/$fname')/DataSources" -Method GET -ContentType "application/json" -UseDefaultCredentials # $ret is correct and $ret.value is an array of datasources # Change datasource path $ret.value | % { $_.Path = "/$dclib/" + $_.Name } # Convert to JSON $body = $ret.value | ConvertTo-Json # Put modified Datasources array back into report $ret = Invoke-RESTMethod -Uri "$restroot/Reports(Path='/$replib/$fname')/DataSources" -Method PUT -Body $body -ContentType "application/json" -UseDefaultCredentials
Solved! Go to Solution.
Solved myself - by increasing tracing level on PBIRS logs and seeing a complaint about JSON payload not matching to an array type. I only had one datasource and due to the amazingly stupid mapping of single-item arrays into the bare item which Powershell does in some circumstances, the endpoint was not getting a JSON array. Fix was to replace:
$body = $ret.value | ConvertTo-Json
with
$body = ConvertTo-Json $ret.value
because the pipe invokes the stupid array unwrapping. This silly behaviour of Powershell is particularly annoying in APIs where datatypes matter so much.
Solved myself - by increasing tracing level on PBIRS logs and seeing a complaint about JSON payload not matching to an array type. I only had one datasource and due to the amazingly stupid mapping of single-item arrays into the bare item which Powershell does in some circumstances, the endpoint was not getting a JSON array. Fix was to replace:
$body = $ret.value | ConvertTo-Json
with
$body = ConvertTo-Json $ret.value
because the pipe invokes the stupid array unwrapping. This silly behaviour of Powershell is particularly annoying in APIs where datatypes matter so much.
Check out the July 2025 Power BI update to learn about new features.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
User | Count |
---|---|
5 | |
4 | |
1 | |
1 | |
1 |
User | Count |
---|---|
8 | |
5 | |
4 | |
4 | |
2 |