How to configure a Custom Connector in Power Apps to call third party Web API
Microsoft has 200+ ready-made connectors to connect native and third party applications. But if the application connector is not available then we can build custom connector.
The below screenshot shows a list of available connectors in Power Apps some are FREE and some are Premium connectors.
Lets take an example of third party WEB API Weather Stack which gives services to get weather of a location. The Website of Weather Stack is https://weatherstack.com/documentation.
To create a custom connector navigate to https://flow.microsoft.com/ and choose correct environment to create a flow. Expand Data option and choose Custom Connector. Click on New custom connector and choose Create from blank.
This will open the connector designer step. in the General Step provide Connector Icon, Icon Background color and Description. Choose Scheme as HTTP and Host as api.weatherstack.com and click next step to provide security information.
In the Security Step choose Authentication Type as API Key and in the API Key Parameter label as ‘API Key’, Parameter name as ‘access_key’ and Parameter location as Query. Then click next step Definition.
In the Definition step give a summary name and description. In the Operation ID give as ‘GETWEATHER’.
In the Request section, Import from sample option and in the pop up panel provide URL as http://api.weatherstack.com/current?access_key=b212a37cc847932e5804rr2a40215bbc&query=New%20York (The access key is used here is from my subscription) you can use your own subscription.
In the Response section click on Add default response and in the Body provide the below response payload.
{"request":{"type":"City","query":"New York, United States of America","language":"en","unit":"m"},"location":{"name":"New York","country":"United States of America","region":"New York","lat":"40.714","lon":"-74.006","timezone_id":"America\/New_York","localtime":"2022-02-13 06:34","localtime_epoch":1644734040,"utc_offset":"-5.0"},"current":{"observation_time":"11:34 AM","temperature":0,"weather_code":326,"weather_icons":["https:\/\/assets.weatherstack.com\/images\/wsymbols01_png_64\/wsymbol_0027_light_snow_showers_night.png"],"weather_descriptions":["Light Snow"],"wind_speed":13,"wind_degree":10,"wind_dir":"N","pressure":1022,"precip":0.6,"humidity":81,"cloudcover":100,"feelslike":-4,"uv_index":1,"visibility":2,"is_day":"no"}}
Now the Validation is Successful.
Now we are done.
Click on Test and create a new connection by selecting new connector created and provide access key and city click Test operation. it will return the result.
Now we are done you can use the connector in Flow and Canvas Apps.
Hope this helps.
Follow my blog for more trending topics on Dynamics 365, Azure, C#, Power Portals and Power Platform. For training, Courses and consulting, call to us at +91 832 886 5778 I am working more for community to share skills in Dynamics 365 and Power Platform. Please support me by subscribing my YouTube Channel. My YouTube Channel link is this : https://www.youtube.com/user/sppmaestro