Hi All,
Is it possible to consume the Dataverse custom API (unbound) from within Power Portals using JS? If so, please share a sample code for the same.
Thanks in advance!
Regards,
Sahil
Hi All,
Is it possible to consume the Dataverse custom API (unbound) from within Power Portals using JS? If so, please share a sample code for the same.
Thanks in advance!
Regards,
Sahil
The second option is quite compelling and I would like to pick your brain on the the GET call that you make to a virtual entity.
As I see it is a fetch xml query to trigger the Retrieve multiple plugin configured with the virtual entity.
I tried this and it does not seem to work the same way as it would for a standard entity with a retrieve multiple plugin configured.
I would like your thoughts on how you would implement the get call from the portal passing a couple of parameters to achieve a desired response of triggering the Virtual entity plugin.
Thanks @tappu02 .
This seems to be a good alternative. I will try to use this somewhere in my project.
There are couple of workarounds we can use to achieve this until the feature is supported in the product.
1. Create a HTTP triggered power automate and call the D365 Custom API from within the flow. Next, call the flow from the PowerApps portal client code.
2. This is an alternate way we tried using Virtual Entity. Configure a virtual entity to contain the same parameters as your Custom API input and output parameters. The Virtual entity Provider expects a plugin configured which in our case would be a Retrieve/RetrieveMultiple plugin configured on the virtual entity. The idea being when a GET call is made on the virtual entity (using REST API), the plugin would get called. The plugin will call your custom API internally and can return the output back. The good part is the RetrieveMultiple plugin gets registered as a Main event in the pipeline instead of as a POST event. Also, as compared to the first approach, you no longer have to maintain the flow URL which can also have security concerns having the signature in it.
Thank you for your response. I believe I had misunderstood the use of portal api. I now understand to call the custom dataverse API you do need the Implicit Grant flow feature from Portal and use a companion api.
Thank you for response and clarification
@steeredprince
Portal Web Api details here https://docs.microsoft.com/en-us/power-apps/maker/portals/web-api-overview
Have you configured the Site Settings and set up the Table and Column permissions?
The above scenario is for consuming an external api securely using the Implicit Grant flow feature from Portal. Your code sample is for consuming the Portal Web Api.
What errors are you getting?
May I request you to elaborate or point to an article or link on how you can call a custom API using the Portal Web API.
I have used the portal web api like shown below but I feel I missing key steps in using that and calling a custom API.
@Sahil
I have a companion app template here:
GitHub - eugenevanstaden/d365-portal-companion-api: Sample API demonstrating how to configure OAuth to authenticate against D365 portal
Once you have the API set up you can consume it from the portal securely by first getting the Auth token and then executing your call to the API endpoint. I use this for custom document upload, payment integration or any secured external service that needs to be consumed from the portal.
eg.
the authUrl would be: portal/_services/auth/token?client_id=abc123
The companionAppUrl would be your endpoint.
$("#checkout-btn").click(function () {
$.ajax({ method: "POST", cache:false, url: "{{authUrl}}", })
.done(function (token) {
$.ajax({
method: "GET",
headers: { 'Authorization': "Bearer " + token },
url: '{{companionAppUrl}}/payment/request?orderid={{orderid}}'
}).done(function (data) {
window.location.href = data.paymentUrl; //redirect to payment page
}).fail(function (error) {
$("#payment-service-alert").show();
});
});
});
The MS examples are here:
https://github.com/microsoft/PowerApps-Samples/tree/master/portals/ExternalWebApiConsumingPortalOAuthTokenSample
Hi,
Is there any other documentation available that you are aware of Companion API or Implicit Grant Flow configuration for Portals and can share? The existing MS docs seems little confusing to me.
Right. We may use Azure APIM to make it secure. Not aware of Portal Implicit Grant Flows, will explore it. Thank you for sharing 🙂
@Sahil wrote:......
I believe that maybe the Power Automate flow (with HTTP trigger) might be an option for me as I need the response parameters back to navigate the portal user accordingly (after custom logic) to the next screen.
Just be aware that the url for the Flow's HTTP trigger can be called publicly by default (i.e. you may need to add security to it). Alternatively use the Portals Implicit Grant Flow https://docs.microsoft.com/en-us/power-apps/maker/portals/oauth-implicit-grant-flow
Fubar
69
Super User 2025 Season 1
oliver.rodrigues
49
Most Valuable Professional
Jon Unzueta
43