I have just been assigned to a very tiny project. Although I have a team lead and other senior developers that I could go to but at the same time I am trying to learn things on my own. Actually there is web api call I need to make. I have been given this Developer Toolkit from this 3rd party. It contains WSDL for the service and few .xsd files and another document that contains the method names. Now I have been told that this call should be a reusable component and we should be able to use it in other projects or even in the same project but other locations.
Everything else is in this project is mainly using D365 forms, a couple of flows and mainly the base entities except for a few custom entities. This web service call needs to be triggered from D365 portal button. This portal stores its data in D365 backend. My question is what would be the best way to make this web service call? My understanding is plugins will not be useful in this case but I am not very knowledgeable about this. So any guidance would be helpful.
Hi @Evangelizt , The best place to start is to start with Portals Web API
You can use the Web API to perform create, update, and delete operations across all Microsoft Dataverse entities from your portal pages.
You can customise the logic to trigger the event from button.
There is a good deep dive tutorial from @OOlashyn https://www.dancingwithcrm.com/powerapps-portal-web-api-deep-dive/.
Hope it helps.
If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.
Hi @Evangelizt ,
Can you elaborate a bit from where you are calling web API (you said in your initial message that it is D365 portal)? Do you need to just call that API or afterwards you need to perform the operation in Dataverse? In general, it doesn't look like a Portal question. You might try to ask in Pro dev forum section.
@OOlashyn sure it's a 3rd party API (provided by local government actually) but no we wouldn't be saving data in dataverse afterwards. It's just to inform the user of a result. This will be invoked via a button in Portal page.
If it is something that you can call via Ajax and do not have to provide private authentication details then you can Ajax on the Portal, but other than that you need to code it inside a plugin or custom action (if processing fits doing it on the Dataverse/server side), other than that you will need to call another Service that you control/develop via Ajax that can act as a pass through to the end service (so you can keep the credentials etc out of public view), one option if you need verification of the Portal User is oAuth Implicit Grant Flow https://docs.microsoft.com/en-us/powerapps/maker/portals/oauth-implicit-grant-flow (I wouldn't call any of it 'simple')
@Fubar @OOlashyn thank you for your replies. Unfortunately I don't think I can use JS here since the username/pwd combination needs to be used to first authenticate with this 3rd party api and putting these credentials in cleartext would create a huge security risk! Let me try to explain my current understanding and I would love to have your expert opinions please:
We have a web portal. It stores data in dynamics. However it needs to make several api calls to 3rd party. There will uid/pwd based authentication for these web apis. These api calls should also be able to made from inside one of the dynamics forms. So in terms of the bigger pictures, this needs to be a reusable component. I am thinking may be an Azure function would be suitable perhaps? which could be invoked both from Power apps Portal web page as well as Dynamics backend.
Hi @Evangelizt ,
Yes, using Azure Function as a middle man is a good idea. Just make sure that you are protecting function API as well (see official docs here). Using Azure Function has the additional benefit of being able to easily reuse them in Power Automate flows as well.
If you need to know that it is an authenticated portal user that is interacting with Azure look into the oAuth Implicit Grant Flow (there are links to sample code at the bottom of the link in my previous post).