Forum Discussion
Set PowerBI datasource parameters programatically using PBI API
- Anonymous5 years ago
Hi Anonymous,
According to your error message, I think it means you are using the wrong update detailed in the rest API.
For this scenario, I'd like to suggest you use 'Get Datasources In Group' API to get the detailed configurations and setting of your data source, then you can use them in update data source API:
Datasets - Get Datasources In Group
Regards,
Xiaoxin Sheng
Thanks for the reply , effectively I was trying to make update with this API today ,
My actual issue is to use the right body params to update the datasource.
Here's what the API preconize.
"updateDetails": [ { "datasourceSelector": { "datasourceType": "Sql", "connectionDetails": { "server": "My-Sql-Server", "database": "My-Sql-Database" } }, "connectionDetails": { "server": "New-Sql-Server", "database": "New-Sql-Database" } },
Here's what I'm sending
I'm gettin 400 error
{
"updateDetails":[
{
"datasourceSelector":{
"datasourceType":"AzureTables",
"connectionDetails":{
"account":"prodcallxxx",
"domain":"table.core.windows.net"
},
"datasourceId":"2b23933c-34a7-4247-94ff-xxxxxx",
"gatewayId":"d1e2a03c-0f55-42fe-b0dd-xxxxxxx"
},
"connectionDetails":{
"account":"prodcallrecord",
"domain":"table.core.windows.net"
}
}
]
}
Error
{
"error": {
"code": "InvalidRequest",
"message": "Parameter UpdateDetails is missing or invalid"
}
}
Hi Anonymous,
According to your error message, I think it means you are using the wrong update detailed in the rest API.
For this scenario, I'd like to suggest you use 'Get Datasources In Group' API to get the detailed configurations and setting of your data source, then you can use them in update data source API:
Datasets - Get Datasources In Group
Regards,
Xiaoxin Sheng