Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Power Apps Pro Dev & ISV
Answered

How to call api from pcf control inside canvas app?

(0) ShareShare
ReportReport
Posted on by

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?

  • Jose Ramon Profile Picture
    97 on at
    Re: How to call api from pcf control inside canvas app?

    Did you manage to make the call? I am in the same situation, in my case I need to authenticate with clientsecret (Confidential Client Application) to get the authentication token. I have done a test with POSTMAN, I have the token and when I put the code in the PCF I have a block by CORS policies.

     

    Access to XMLHttpRequest at xxxxxx from origin xxxxxx has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource

     

  • Verified answer
    cchannon Profile Picture
    4,702 Super User 2025 Season 1 on at
    Re: How to call api from pcf control inside canvas app?

    @Anonymous 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.

  • cchannon Profile Picture
    4,702 Super User 2025 Season 1 on at
    Re: How to call api from pcf control inside canvas app?

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

  • cchannon Profile Picture
    4,702 Super User 2025 Season 1 on at
    Re: How to call api from pcf control inside canvas app?

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

  • Community Power Platform Member Profile Picture
    on at
    Re: How to call api from pcf control inside canvas app?

    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?

  • cchannon Profile Picture
    4,702 Super User 2025 Season 1 on at
    Re: How to call api from pcf control inside canvas app?

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

  • Community Power Platform Member Profile Picture
    on at
    Re: How to call api from pcf control inside 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?

  • cchannon Profile Picture
    4,702 Super User 2025 Season 1 on at
    Re: How to call api from pcf control inside canvas app?

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

     

    @Anonymous 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.

     

     

  • a33ik Profile Picture
    3,304 Most Valuable Professional on at
    Re: How to call api from pcf control inside canvas app?

    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?

  • cchannon Profile Picture
    4,702 Super User 2025 Season 1 on at
    Re: How to call api from pcf control inside canvas app?

    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.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Leaderboard > Power Apps - Power Apps Pro Dev & ISV

#1
WarrenBelz Profile Picture

WarrenBelz 89 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 72 Super User 2025 Season 1

#3
mmbr1606 Profile Picture

mmbr1606 71 Super User 2025 Season 1

Overall leaderboard