I am trying to use the API to query the set of tables associated with a given dataset.
This works correctly on the sample dataset and on the dataset I 'created' through the API.
But, it does not work with one of my existing datasets that was tied to an SQL datasource. I would not think that should matter, because the data is already set up within PowerBI.
It may be that it has some rows in it that it does not understand, but the error message is not very informative:
StatusCode: 501, ReasonPhrase: 'Not Implemented'
public static void PowerBiMain()
{
token = AccessToken();
var datasetId = GetDatasets().value.GetDataset(datasetName).Id;
var tables = GetTables(datasetId);
}
public static Tables GetTables(string datasetId)
{
Tables response = null;
try
{
var request = DatasetRequest(String.Format("{0}/{1}/tables", powerBiApiUrl, datasetId), "GET", token);
var responseContent = GetResponse(request);
var json = new JavaScriptSerializer();
response = (Tables)json.Deserialize(responseContent, typeof(Tables));
}
catch (Exception ex)
{
Console.WriteLine("Data: "+ex.Data);
Console.WriteLine("Message: " + ex.Message);
Console.WriteLine("Source: " + ex.Source);
Console.WriteLine("TargetSite: " + ex.TargetSite);
Console.WriteLine("StackTrace: " + ex.StackTrace);
}
I have encountered this problem too, but my research shows that unless the dataset was created through the Power BI Rest API, you cannot list the tables or push data to the dataset. This is unfortunate, hopefully this will change with the ongoing speedy evolution Power BI continues to go through, but I can think of reasons why it won't.
One of the biggest side effects of this is you miss out on using measures on a dataset created through the Rest API.
https://community.powerbi.com/t5/Developer/REST-API-and-Power-BI-Desktop/td-p/20891
https://msdn.microsoft.com/en-us/library/mt203556.aspx
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With