Forum Discussion

frolesti's avatar
frolesti
Frequent Visitor
2 years ago

PowerBI API - Export To File call failing miserably

Hi there!


I am using the PowerBI API from an external application, trying to export PBI reports from it but keep having the same vague error message: 
{
"message": "{\"error\":{\"code\":\"InvalidRequest\",\"message\":\"Export report was called with a bad request\"}}",
"error": true,
"errorCode": "",
"logout": false,
"data": []
}

 

I have seen some messages in here with similar issues but none has worked for my case. I am not really sure where to watch since I couldn't find what should be the proper configuration to be sent to the API, but when sending the reportConfig variable as empty, I can export the file (which makes no sense to me). This is my current reportconfig.identities object:

 

 

 

 

"identities": [
    {
        "customData": null,
        "datasets": ["cacd616a-9d18-4b8d-a072-12888be88566"],
        "identityBlob": null,
        "reports": null,
        "roles": [],
        "username": "[email protected]"
    }
]

 

 

 

 

 

I have seen in previous interventions that some versions needed to delete the reports property in order to adapt to the latest changes of the API but it did not solve my issue.

 

Does anybody have dealt with something similar or has any idea on how to deal with this?

4 Replies

  • AmosHersch's avatar
    AmosHersch
    Microsoft Employee

    Hi frolesti ,

     

    Seems that you are trying to provide an effective identity for your dataset.

    Does your dataset have RLS applied? If not then I think this is the reason for the error. The only reason for providing an effective identity for a dataset is for applying RLS filtering during the export rendering.

     

  • frolesti's avatar
    frolesti
    Frequent Visitor

    Yes, RLS is activated in the dataset. It has worked until recently, I had some error before related to the roles, I have added a conditional with an empty array for strings and the roles error disappeared, but now I have this one. I don't know, it seems like something has happened since the code hasn't been modified for a long time.

    • AmosHersch's avatar
      AmosHersch
      Microsoft Employee

      frolesti I think that an effective identity with username and without roles isn't valid in most scenarios.

      Why aren't you passing the required role?

      • frolesti's avatar
        frolesti
        Frequent Visitor

        Hi

         

        We are not passing roles since we are dealing with the reports fom an external application and the roles are manually added from there, so most of the roles come back as empty.

        I don't know if there is some kind of standard role such as "reader" or something like that that can provide an existing role and will prevent the error from happening.

        I am not profficient in PowerBI so I did not know that this was so conflictive. I'd like to know as well if you recommend to pass this role from powerBI or should I pass it in the backend of my app to act as a safenet.

        Thank you in advance!