Skip to main content

Notifications

Announcements

No record found.

Customer experience | Sales, Customer Insights,...
Unanswered

Configure external API Rest in power pages

Posted on by 5

Hello everyone.

 

We are designing a portal for a client using power pages. We have some external APIs by the client (they return PDF). We have done tests with js and everything goes well, we can visualize those pdf.

 

Using the help of Postman we use Javascript fetch. We do not know how to implement the authentication and the URL in power page, for security we must configure that part.

 

Also comment that the URL of the queries there are values ​​that we concatenate with code liquid, I explain:

 

On one page we display the details of a record from our CRM using:

{% if request.params.id %}
{% assign invoice = entities['dev_invoice'][request.params.id] %}

This way I can use invoice.dev_numberInvoice inside a variable:

var number = '{{dev_numberInvoice}}'; //dev_numberInvoice is a column of my table

And in the API URL it would be something like this:

var myHeaders = new Headers();
  myHeaders.append(
    "Authorization",
    "tokentokentokentokenslkjdlskdjlsakdj"
  );

  var requestOptions = {
    method: "GET",
    headers: myHeaders,
    redirect: "follow",
  };
var urlAPI = "https://customercompany.com/api/v1/customer/22/invoice/"   number;

fetch(urlAPI, requestOptions)
.then........

You can see that the 22 of the URL can be another field, a lookup

 

I have been able to do all this within the editor at the bottom of the power page, but of course it would not be correct.

How can I configure the token that this external API gives us in power pages? I have seen Nodejs being used, but I don't know if I can use all of that within the microsoft environment.

Other information I have found is OAuth 2.0 implicit grant flow within your portal, but I'm not sure if inside power pages or make.powerapps.com it can be done.

I would appreciate help or knowing where I can start.

Thank you very much.

Best Regards.

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans