I'm looking to post a PBIX file up to a workspace through the .NET API using the PostImportWithFile method of the PowerBiClients Imports object. The code is pretty much identical to that seen in option 6 of the Provision Sample (see https://github.com/Azure-Samples/power-bi-embedded-integrate-report-into-web-app/blob/master/ProvisionSample/Program.cs).
There is a workspace collection and a workspace that have been created. The workspace was created through code using the relevant API methods so I know that the authentication side of things is working correctly.
When I call the PostImportWithFile method I'm getting a BadRequest exception being thrown. To verify that this wasn't something to do with my code I've compiled and run the ProvisionSample and selected option 6 and selected the same file and received the same result.
I'm supplying null for the dataset parameter, which is optional and defaults to null anyway, so I can't see this being the cause of my issues.
I've been unable to find anything online regarding this method and a BadRequest so was wondering if there was anyone with experience with this API that had run into something similar?
The PBIX file works fine through Power BI Services, so I'm assuming nothing is wrong with the file.