If you have a need to connect with data from another line of business systems using PowerApps, you can create a custom connector. If you are trying to connect to any on premises systems, you need to setup an on premises data gateway to start with. I will leave on setting up and configuration of on premises gateway for another blog post topic. For now, I will assume that you have gateway setup and ready for use.
After you login to PowerApps using your school or work Office 365 account, there is a section for custom connectors under Data, in left hand navigation menu. To create new custom connector, select the drop down + Create custom connector. You have option to create from blank, Import an OpenAPI file , Import an OpenAPI from URL or Import a Postman collection. For this blog, I am going to select ‘Import from Postman collection’ option.
You can start from blank and fill all the options. For this post, I want to create a connector for REST web service hosted on premises which is not available outside the network. Since i use Postman tool to test the REST webservice calls, importing Postman collection will save some time for me. Postman tool is very handy in testing REST API calls. It allows you to save your calls as a collection.
I have my postman collection exported and saved to my desktop. While exporting your collection Postman suggests you to save as version v2.1 as recommended. But to import it to PowerApps it should be saved as version v1 which is now deprecated. Make sure to save your collection as v1 version.
In this step, you have the option to set description and option to upload and image for connector and selecting background color. There is a check box which lets you connect via on-premises data gateway. This box has to be checked since my REST web service is hosted in an on premises server and accessible to cloud only via gateway. Next, there is option to select HTTPS or HTTP protocol scheme. You need to specify the Host URL and base URL.
In this step, you need to specify an action and specify parameters required for the action. Add an action by selecting the +New action button. Specify the summary, description and Operation ID, which should be unique.
You can add as many actions you can perform with web service with unique ID for each one.
You need to setup a connection to test the connection. Click on New connection, it should give me option to entry username & password and also set gateway. If your gateway is configured properly, it will show up as a drop down option. It gives me the option to enter username & password only because in Step 2, I selected the authentication type as Basic. Once you create connection & enter parameters required to make the web service call, select Test operation.
Note: It might take 15 – 20 mins from the time you save your connector and get a 200 status. If you test immediately after setting up your connector, you may see 404 resource not found error. I believe it takes couple of minutes for the connection to get registered and be available. If you get a resource not found error, wait from sometime and test again.
You have your custom connector ready to be utilized in a Flow or a PowerApp.