| Muhammad Hassan
A custom connector is a wrapper around an API that allows Logic Apps, Power Automate, or Power Apps to communicate with that API. During the development stage of an API (which is to be consumed by a custom connector) we are not able to connect because locally hosted APIs are inaccessible by a connector(Cloud). In this article we will be learning how to access locally hosted APIs from cloud.
We will be using ngrok here which provides a globally accessible host url to your local host. For this head over to your browser and enter the following url: https://ngrok.com/download
Download the zip file and double click on the executable file after extracting it. This will open a command line interface.
Now go to make.powerapps.com and sign in. Then expand the ->Data option, click on ->custom connector and click on ->Create from blank.
Now go to the ngrok CLI and Enter the following command: ngrok http https://localhost:44344 -host-header="localhost:44344" and hit Enter. This will provide you http and https urls to access your local host. We will be using https here but http can also be used. Now my local host https://localhost:44344 can be accessed by https://3a42-202-47-44-135.ngrok.io
Note: Enter your local host URLs above.
Then go to powerapps and Enter the details including the new ngrok url like below.
Now go to security and provide the security to access your API. I am not using any security for my API.
In the Definition’s tab add an action and provide the relevant details then click on import from sample to set the request sample.
After that click on default response and enter the json response from your API.
Then hit save or update and test your custom connector.
Join us next time, as we continue our journey of learning canvas apps.Click here to learn more about Imperium's Power Apps Services. We hope this information was useful, and we look forward to sharing more insights into the Power Platform world.