[MUSIC]
>> Module 5, Integrate
Content with the Power BI Client APIs.
Hello, I'm Peter Myers, the course developer.
>> I'm Amit Shuster,
product manager of Power BI Embedded Analytics.
>> In this video, we continue to describe
the development methodology for
embedding Power BI content,
now with a focus on enhancing the end-user experience.
>> Integrate and enhance
embedded Power BI content with the Power BI client APIs.
Our client API supports both JavaScript and TypeScript.
Before that, let's go and see how it works.
What you can see here, this is
the Customer Service Insights sample environment.
You can see here the client application,
where you have the left nav and the top action bar.
On the right side, you can see the embedded report.
This report is separated by an iFrame that separates
the application code from
the Power BI report and creates a separation.
What you can do in order to
communicate with this report,
you can use the client APIs and use
the bi-directional communication that
the client APIs provide you to
communicate between the application code and the report.
>> Let's now describe what's
possible for you to do in your apps.
The Power BI client APIs support many capabilities:
User interactions could be
natively supported by the report view.
>> You will have all the interactions that you currently
have in the Power BI service, so you
can slice and dice, and you can highlight
the report or drill through or drill up,
drill down within a visual.
>> User interactions can also
trigger subscribable events.
>> Peter, here, like some of
the events that I want to mention are
the options to see what the user is clicking on,
so you can listen to the visual clicked events
or button clicked.
You can also listen to
the page navigation event to see
what page the user is currently viewing.
>> There is also programmatic interaction.
>> I can do things like set a filter or set
a slicer to get the report in a specific state.
>> There is dynamic report layouts.
>> With dynamic report layout,
you can set different views in different screens.
For example, I can create
a specific view for
a tablet or a specific view for mobile.
>> What about capturing and sharing bookmarks?
>> Bookmarks allow you to save the view of
the report and will allow you to capture the view
on the fly and also apply
saved views that are currently saved in the report.
>> Report visual creation and personalization.
>> We allow you to create a report on
the fly by using our report offering
APIs where you can create visuals and
also modify them, and personalize them as you need.
>> Lastly, embed token regeneration when tokens expire.
>> In order to keep your user session always active,
you will need to refresh
the embed tokens that its currently using.
This can be done with the SetAccessToken method.
>> Let's now introduce the packages available to you.
>> First, we have the powerbi-client package.
This is our main package that
supports both JavaScript and
TypeScript and allows you to
use our APIs that we talked about before,
and integrate Power BI into your apps.
Second, we have the powerbi-models package,
which contains JavaScript and TypeScript object models.
Whenever you need the contracts
for the APIs that you're using,
you should use the powerbi-models.
Then we have the powerbi- report-authoring package.
This package contains functionality that helps you edit
and create visuals on the fly.
This is an extension of the powerbi-client library.
Last, we have the powerbi- client-react package.
This is a specific package
for React that will allow you to
easily embed Power BI content in a React web application.
>> Consider that the client APIs can allow
you to drive an in-context analytics workflow.
Well, what does that mean?
Let's show you by example.
>> First, the user navigates within the app to
the place where you have the report embedded.
Then the app shows a report
of these filtered to a specific view.
Now, the user interactively filters the data
in the reports so we can slice and dice the data.
Then when the user clicks on a button,
and can perform an action,
and the app responds by running
some custom code that is part of the application code.
>> That sounds great. How about we see how
this works by an example from the Power BI Playground?
>> Great idea, Peter.
Let me demonstrate this example
in the Power BI Embedding Analytics Playground.
Here in the Playground, I'm going to demonstrate to you
the showcase of "Go from insights to quick action."
I'll just go to the left nav and open the
"Showcases" and click on the first one,
"Go from insight to quick action."
Now you can see the Contoso app,
where the Contoso company wants to create
a campaign with their custumers.
The first thing I'm going to do is use
the slicers at the top to filter
this reports to show
only the customers that have
purchased in the last seven days.
The report now shows me
customers that purchased in the last seven days.
The next thing I'm going to do is, I'm going
to click on the button on
the right upper corner where you see "Create a campaign."
When I clicked on this button,
this ran custom application code
that exported the data from this table and
also opened this dialogue that I can now do
additional level of filtering before
sending a coupon or sending a discount.
What I might choose to do is remove people from the list.
Let's remove a few of them.
Then I'm going to click on "Send coupon."
Here, I can change the title and
insert additional message and after that click on "Send."
What you just saw here,
this is a way to integrate
Power BI in your apps and go from insight
to action and connect
the Power BI report to your application.
>> Great. Well, in the next video,
I'll demonstrate enhancing my app
by adding client-side logic,
specifically adding a client-side filter
and also adding a context menu.