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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
ssce
Frequent Visitor

Error when trying to change PowerBI report parameters with the API

Hi,

 

I am trying the new option within the API with Reporter Server October 2020 version to update parameters. The idea is that the PowerBI report is deployed to different servers and I will update the parameter "servername" with the matching server name.


I am following the guide here: https://docs.microsoft.com/en-us/power-bi/report-server/connect-data-source-apis

This works fine unless the parameter contains a special character. In my case Swedish characters like (å). When I want to change the parameter and the parameter value contains this character it shows me this error:

"Unable to apply new parameters: System.Collections.Generic.List`1[Model.DataModelParameter] to the datastore due to Microsoft.ReportingServices.Portal.Interfaces.Exceptions.InvalidDataModelParameterException: There was an error uploading your .pbix file.  Verify that the file has not been corrupted and that the file extension matches the format of the file. ---> System.Net.ProtocolViolationException: Bytes to be written to the stream exceed the Content-Length bytes size specified.\r\n   at System.Net.ConnectStream.InternalWrite(Boolean async, Byte[] buffer, Int32 offset, Int32 size, AsyncCallback callback, Object state)\r\n   at System.Net.ConnectStream.Write(Byte[] buffer, Int32 offset, Int32 size)\r\n   at System.IO.StreamWriter.Flush(Boolean flushStream, Boolean flushEncoder)\r\n   at System.IO.StreamWriter.Dispose(Boolean disposing)\r\n   at System.IO.TextWriter.Dispose()\r\n   at Microsoft.ReportingServices.Portal.ODataWebApi.Utils.PbixReportHelper.BuildUpdateDataModelParametersWebRequest(Guid catalogId, IList`1 dataModelParameters, String powerBiUri, ILogger logger, IPrincipal userPrincipal, String reportServerHostName)\r\n   at Microsoft.ReportingServices.Portal.ODataWebApi.Utils.PbixReportHelper.UpdateDataModelParametersInPowerBI(Guid catalogId, IList`1 dataModelParameters, String powerBiUri, ILogger logger, IPrincipal userPrincipal, String reportServerHostName)\r\n   at Microsoft.ReportingServices.Portal.ODataWebApi.Common.PowerBIReportsControllerHelper.UpdateDataModelParametersInAS(Guid id, IList`1 parameters)\r\n   --- End of inner exception stack trace ---\r\n   at Microsoft.ReportingServices.Portal.ODataWebApi.Common.PowerBIReportsControllerHelper.UpdateDataModelParametersInAS(Guid id, IList`1 parameters)\r\n   at Microsoft.ReportingServices.Portal.ODataWebApi.V2.Controllers.PowerBIReportsController.<PostDataModelParameters>d__33.MoveNext()"
 
I have found som indication as this is an issue with Invoke-WebRequest which is used when I follow the example mentioned earlier.

Anyone else seen this issue and found a solution?

Stefan



 

8 REPLIES 8
Anonymous
Not applicable

Hi @ssce 

I got a workaround from Microsoft Support Team that worked for me. We can use the "Url Encoding" code for special characters (e.g %C3%A5 for the character 'å'). You can find the list of these codes here.

Tell me if this workaround solves your issue too.

Have an amazing day!

Anonymous
Not applicable

Hi @ssce 

With PBI RS May 2022, I had the same issue when I tried to update parameter value with the character 'é'. It seems that the REST API DataModelParameters can't handle character with unicode > 127 (\u007f). I sent a Support Request to Microsoft and they answered:

short update: I was able to fully reproduce your issue. I will check internally if there is a workaround or potential fix. Please understand that this will take some time.

I will keep you posted.

Have an amzing day!

ssce
Frequent Visitor

I have tested the call to the API using Postman as well with the same error as a result.

 

So it seems like a bug or is there any setting in the Power BI Report server which I need to set that the API can accept swedish caracters?

Hi, @ssce 

 

Is the type of the parameter text? If the problem can be resolved by changing into universal characters, it should not support Swedish characters. Thanks.

 

Best Regards

Janey Guo

 

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

Hi,

 

Yes the parameter is text. Can you suggest a code fragment how to change the text to universal characters and how to post it to the RestAPI? 
Thx.

Stefan

Hi, @ssce 

 

If it is a  incompatibility problem, it is difficult to change, but we can change ourselves. The most direct and quick way is to change server name which doesn't contain incompatible characters. 

 

Best Regards

Janey Guo

 

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

It is working fine when the parameter is set when uploaded directly from Power BI Desktop. It seems like it is a bug within the RestAPI.

I can work around the issue in this situtation but I can imagine that this is not always possible to do that.

Hi, @ssce 

 

I find some information about support language.

REST API national language support (ibm.com)

2.png

Best Regards

Janey Guo

 

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

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.