Forum Discussion

ssce's avatar
ssce
Frequent Visitor
5 years ago

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

  • ssce's avatar
    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?

    • v-janeyg-msft's avatar
      v-janeyg-msft
      Community Support

      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.

      • ssce's avatar
        ssce
        Frequent Visitor

        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

  • Anonymous's avatar
    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!

  • Anonymous's avatar
    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!