Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!
Hi, I am trying to update data sources of datasets in a workspace, with API v2. I use C#.
My code is
powerBIClient.Datasets.SetAllDatasetConnectionsInGroup(workspaceId, datasetId, new ConnectionDetails(connectionString));
Unfortunately, this causes a "Bad request" error. Instead of this, I used
var dataSources = powerBIClient.Datasets.GetDatasourcesInGroup(workspaceId, datasetId).Value.ToList();
foreach (var dataSource in dataSources)
{
dataSource.ConnectionString = connectionString;
}
Is this the correct way of doing it?
Solved! Go to Solution.
The link of that request recommends using this Update Datasources in Group:
https://docs.microsoft.com/en-us/rest/api/power-bi/datasets/update-datasources-in-group
Please read the limitations in the post to be sure you can do what you are looking for.
I hope that helps
Happy to help!
Hi. Bad request is usually about having a wrong url or parameters. In your case using the C# library will help you always getting the correct url. However, if you have already try some requests and are working, you should take a look at the documentation of the API.
I have just read that the Set All Dataset Connections In Group is deprecated and no longer supported 😞
https://docs.microsoft.com/en-us/rest/api/power-bi/datasets/set-all-dataset-connections-in-group
I don't think you can do that any more. It suggests using Update Datasources In Group. You can try that one.
I hope that helps,
Happy to help!
Thanks, that is helpful. Could you give me the exact api operation to update datasources in the api?
The link of that request recommends using this Update Datasources in Group:
https://docs.microsoft.com/en-us/rest/api/power-bi/datasets/update-datasources-in-group
Please read the limitations in the post to be sure you can do what you are looking for.
I hope that helps
Happy to help!