Since the last major update last year, Power BI offers some APIs which can be used to interact with content and also data that is stored in Power BI. Microsoft provides a good set of samples on how to use the APIs on GitHub and also a an interactive APIARY web-UI which you can use to build and test API calls on-the-fly. However, it can still be quite cumbersome as you have to deal with all the REST API calls and the returned JSON on your own. So I decided to write a little C# Wrapper where you simply pass in your Azure AD Application Client ID and you can deal with all Object of the Power BI API as they were regular C# objects.

Here is a little example on how to list all available reports and get the EmbedURL of a given tile using the PowerBIClient:

As you can see, its pretty simple and very easy to use, even for non-developers. You can find all the source-code and the sample application for download below. The code as I have written it is very likely not the best code possible, but it works for my needs, is straight forward, simple and saves me a lot of work and time when dealing with the PowerBI API. Also, if the API changes, you may need to adopt the code accordingly. However, for the future I hope that Microsoft provides some metadata so that VisualStudio can build all this code automatically using e.g. Swagger. But for the time being feel free to use, improve or extend my code

yes, I have seen it. it looks very good and is probably a much better code than mine. But to be fully honest, its too advanced for me (and I guess also to must other users) and I like to understand the code that I am using in my projects:)

and as I said, I still hope for MS to publish the API metadata so we can use VS to generate all this code for us automatically …

I’m investigating the generation of a data feed to Azure Power BI, along with the Azure Power BI parameters that are required to generate a graph in Azure Power BI.

A series of questions will be presented to the user using a set of rules that determine the next question(s) to be presented — these questions will determine which data (held in Azure SQL) is to be used by Azure Power BI to generate a graph.

The parameters of the graph will be included as part of the feed to Azure Power BI, or the feed will select a pre-saved template in Azure Power BI for the graph to be generated.

I would be interested to view any cases where something like this has been achieved.

I want the Same in C# Code but with different parameters like Start Date and End Date.I have done this on power bi desktop with Manage parameter functionality but Now I Want to pass these parameters dynamically from C# Code. Can you please update me for the same if you have any idea.

So you basically have a PowerBI Desktop template with parameters (StartDate/EndDate) and want to do the following via C#:
1) load the template
2) set the parameters
3) upload it to the PBI service
4) refresh it online with the previously set parameters
so far correct?

The REST API is only here to interact with the service and not with any desktop component so steps 1) and 2) will not work. However, steps 3) and 4) will definitly work via the API

Hi,
Actually In power bi I am using stored procedure and that procedure needs Start Date and End Date to execute. So I pass that parameters to stored procedure using Manage Parameter. Now I want to integrate this dynamic report with web. From Web I want to pass these parameter to execute Stored procedure and get result.

If you know any other way to do this please let me know. I really need this asap.

Well, you cannot trigger a parameterized refresh through a query from the UI.
You could only try a live connection instead and use views instead of procedures. However, performance will be less good but it should work for your scenario

Just to give you a background, we have hit an issue with Power BI on Dynamics CRM Online. We are getting data from Dynamics CRM Online using Fetch XML . However, we are able to fetch only 5000 records using FetchXML due to its limitation. I read somewhere that we can use Use FetchXML with a paging cookie to fetch the complete dataset. This includes writing C# code.

So, I was wondering if we can write c# code to get complete data from Dynamics CRM using FetchXML with paging cookie and get the data to be refreshed on a scheduled basis.

I’d say that you can achieve the same also with PowerQuery – have you tried this yet?
I would not use the Push API unless you really need real-time data and your scenario seems to be more like a workaround

We are currently trying to extracts data from CRM online using fetchxml.
To overcome limit of 5000 records we are trying to make smaller extracts of data based on date ranges.
For example we have monthly extracts for all cases and we are passing that condition(based on dates) as part of fetchxml.
The data runs well in power BI desktop . However, it faces refresh issue in Power BI online.

We are thinking to have a workaround. Please do let us know if there are any pointers to alternative