Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hello
I used the REST API to update Power BI Reports with a C# Application, but I had no luck with updating the PowerBIReport DataSource. I have a connection to an on-prem Anaysis Services Tabular.
I tried it as it is described here: https://app.swaggerhub.com/apis/microsoft-rs/PBIRS/2.0#/
Sections:
GET /PowerBIReports({Id})/DataSources --> Works fine
PATCH /PowerBIReports({Id})/DataSources --> NO LUCK, always (400) Bad Request.
PUT instead of PATCH gives (405) Method Not Allowed
Are there C# examples? For me, just the Swagger is not enough to understand what I have to do...
Greetings,
Roli
Solved! Go to Solution.
OK, here my experiences with the Swagger on 2018-02-03 (can vary if you do it after that date because of updates)
Create IO.Swagger Assembly
ManifestItem.ToJson()
public virtual string ToJson()
Use IO.Swagger Assembly in your Application
using IO.Swagger.Api; using IO.Swagger.Client; using IO.Swagger.Model; using RestSharp;
var clientCI = new CatalogItemsApi(apiString); clientCI.Configuration.ApiClient.RestClient.Authenticator = new NtlmAuthenticator(CredentialCache.DefaultCredentials); ODataCatalogItems cItems = clientCI.GetCatalogItems();
Updating PowerBIReports DataSources
//Get PowerBIReport var clientPBIR = new PowerBIReportsApi(apiString); clientPBIR.Configuration.ApiClient.RestClient.Authenticator = new NtlmAuthenticator(CredentialCache.DefaultCredentials); PowerBIReport pbir = clientPBIR.GetPowerBIReport(id); //Update ConnectionString ODataDataSources odataDS = clientPBIR.GetPowerBIReportDataSources(id); odataDS.Value[0].ConnectionString = "..." //To be replaced clientPBIR.UpdatePowerBIReportDataSource(id, odataDS.Value);
Happy coding!
Roli
OK, here my experiences with the Swagger on 2018-02-03 (can vary if you do it after that date because of updates)
Create IO.Swagger Assembly
ManifestItem.ToJson()
public virtual string ToJson()
Use IO.Swagger Assembly in your Application
using IO.Swagger.Api; using IO.Swagger.Client; using IO.Swagger.Model; using RestSharp;
var clientCI = new CatalogItemsApi(apiString); clientCI.Configuration.ApiClient.RestClient.Authenticator = new NtlmAuthenticator(CredentialCache.DefaultCredentials); ODataCatalogItems cItems = clientCI.GetCatalogItems();
Updating PowerBIReports DataSources
//Get PowerBIReport var clientPBIR = new PowerBIReportsApi(apiString); clientPBIR.Configuration.ApiClient.RestClient.Authenticator = new NtlmAuthenticator(CredentialCache.DefaultCredentials); PowerBIReport pbir = clientPBIR.GetPowerBIReport(id); //Update ConnectionString ODataDataSources odataDS = clientPBIR.GetPowerBIReportDataSources(id); odataDS.Value[0].ConnectionString = "..." //To be replaced clientPBIR.UpdatePowerBIReportDataSource(id, odataDS.Value);
Happy coding!
Roli
could you help me some tips? how to upload a pdix file to the power BI server in the
using IO.Swagger.Api; using IO.Swagger.Client; using IO.Swagger.Model
var clientCI = new CatalogItemsApi(apiString); clientCI.Configuration.ApiClient.RestClient.Authenticator = new NtlmAuthenticator(CredentialCache.DefaultCredentials); clientCI .upload()//how to use the api? thanks very much
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
9 | |
5 | |
4 | |
3 | |
2 |
User | Count |
---|---|
11 | |
11 | |
7 | |
3 | |
2 |