cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
shahriat
Helper II
Helper II

How to call api from pcf control inside canvas app?

I am developing a pcf control for canvas app. 

 

I want to call api like  /api/data/v9.2/accounts from pcf control inside canvas app.

 

What is the workaround to make it possible?

1 ACCEPTED SOLUTION

Accepted Solutions

@shahriat did these answers help solve your problem? If so, please mark one or more posts as a Solution to help others see this post as Solved.

View solution in original post

9 REPLIES 9
cchannon
Super User
Super User

uncomment the 

<uses-feature name="WebAPI" required="true" />

in your control manifest and a webAPI object will become accessible in your context object. This webAPI object contains functions for your most common webAPI operations, such as retrieve, retrievemultiple, create, update, etc.

As far as I know WepApi won't be available in the component used in "Canvas Apps". @cchannon did I miss the moment when WebApi was enabled there?

D'oh! Thanks @a33ik: I typed without thinking.

 

@shahriat you will need to organize your Inputs and Outputs to exchange data back and forth between your Canvas App and PCF. So, any data your PCF needs to read will need to be pulled by the app and passed in as Inputs and any writes will need to be passed back to the Canvas for handling.

 

The only reasonable workaround to this is to implement your own Authentication within the PCF using MSAL so that you can call the DB directly without sending traffic back through the Canvas App.

 

 

@cchannon Thanks for your reply and suggestion. Do you know is it possible to pass account's entity list through input from canvas app to pcf control?

Yes, if the control is a dataset type you can feed it any dataset you like, including Accounts.

Hi @cchannon

Thank you very much for your such a valuable answer. I have another last question. I am trying to integrate msal in my pcf canvas app control. Do you know what should I add as a redirect url for msal configuration? For example:  I am trying to access xxx.crm6.dynamics.com/api/data/v9.2/accounts from pcf canvas app. In this case what should be the redirect url?

I believe it is just your organization URI: 
https://myorgname.crm.dynamics.com

Yep. Here is a walkthrough I found on it. This person is calling Graph API, but the concept is the same.

@shahriat did these answers help solve your problem? If so, please mark one or more posts as a Solution to help others see this post as Solved.

View solution in original post

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Microsoft Ignite 768x460.png

Find your focus

Explore the latest tools,training sessions,technical expertise, networking and more.

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Users online (2,071)