Crafting Your Own Connector: Bringing Any REST API into Power Apps and Power Automate
When the connector gallery doesn’t have what you need, build your own. Follow a practical example with a free weather API to master the complete custom connector workflow.
More than 500 pre-built connectors ship with the Power Platform, but there will always be the one API you need that isn’t covered. Custom connectors fill that gap by letting you define your own interface to any REST API. Once created, your connector behaves like a first-class citizen in Power Automate and Power Apps—triggers and actions appear in the designer just like any Microsoft-provided connector.
In this guide you’ll build a working custom connector step by step, using a free weather API. Along the way you’ll learn how authentication, parameters, and response schemas work, and you’ll leave with a reusable connector that you can extend or adapt to other services.
What You’ll Need
- A Power Apps or Power Automate license (a developer plan works).
- Access to Power Automate for connector creation.
- An API key from OpenWeatherMap (the free tier is enough).
- Basic familiarity with REST APIs and JSON.
The Story: A Weather Connector
Imagine you’re building a Power App that needs to display current weather conditions for any city. There’s no built‑in OpenWeatherMap connector, but the service has a clean REST endpoint that returns temperature, wind, and sky conditions in JSON. Your custom connector will expose a single action named Get Weather that takes a city name and optionally the unit system, and returns the parsed weather data.
Get Your API Key
- Sign up for a free OpenWeatherMap account.
- After verifying your email, log in and navigate to the API keys tab.
- Copy your default key or create a new one. Keep this key private—it will be your connector’s password.
Understand the API Endpoint
OpenWeatherMap’s current‑weather endpoint follows this pattern:
https://api.openweathermap.org/data/2.5/weather?q={city name}&appid={your API key}&units={metric|imperial}You can test it directly in a browser by replacing {city name} with a city and {your API key} with the key you just copied. The response is a JSON object containing weather data. We’ll use this URL later when importing the request.
Build the Connector in Power Automate
You’ll define the connector inside Power Automate, but it will automatically be available in Power Apps after creation.
1. Start a New Custom Connector
- In Power Automate, expand the Data menu on the left and select Custom connectors.
- Click + New custom connector, then choose Create from blank.
2. Fill in General Information
Give the connector a name and set the host URL and base path.
| Field | Value |
|---|---|
| Name | WeatherAPI |
| Scheme | HTTPS |
| Host | api.openweathermap.org |
| Base URL | / |
Optionally upload a 32×32 icon for your connector.
3. Configure Security
OpenWeatherMap expects the API key as a query parameter named appid.
- Authentication type:
API Key - Parameter label:
appid(shown on the connection screen) - Parameter name:
appid(the query parameter name) - Parameter location:
Query
At test time you’ll supply your actual key here.
4. Define the Action
Go to Definition and click + New Action. Fill in the general fields:
- Summary :
Get current weather - Description :
Returns current weather data for a given city using OpenWeatherMap. - Operation ID :
GetWeather(used in Power Apps – no spaces)
Import the Request
In the Request section, click Import from sample. Set Verb to GET, paste your test URL (with your API key), and click Import.
https://api.openweathermap.org/data/2.5/weather?q=London&appid=abc123def456&units=metric
Power Automate will parse the query parameters. Delete the appid parameter—it’s already handled in the security step and should not be treated as an action parameter.
Edit the remaining parameters:
q: Set as Required, give a description like “City name (e.g., London, Tokyo).”units: Leave optional, description “Metric or imperial. Default standard (Kelvin).”
Add a Default Response
Click Add default response in the Response section. Paste a sample JSON response (copy your test URL’s output) and click Import. This step creates a schema so that Power Automate and Power Apps can understand the output shape.
{
"coord": { "lon": -0.1257, "lat": 51.5085 },
"weather": [ { "id": 800, "main": "Clear", "description": "clear sky", "icon": "01d" } ],
"main": { "temp": 285.15, "feels_like": 283.71, "temp_min": 283.71, "temp_max": 286.48, "pressure": 1012, "humidity": 72 },
"visibility": 10000,
"wind": { "speed": 4.12, "deg": 260 },
"clouds": { "all": 0 },
"dt": 1681665600,
"sys": { "type": 2, "id": 2075535, "country": "GB", "sunrise": 1681617086, "sunset": 1681665040 },
"timezone": 3600,
"id": 2643743,
"name": "London",
"cod": 200
}5. Save the Connector
Click Update connector in the top toolbar. The definition is now persisted.
6. Test the Connector
- Switch to the Test tab.
- Click + New connection.
- Enter your OpenWeatherMap API key in the
appidfield and create the connection. - Refresh the operations list, select the GetWeather action, enter
Londonfor the “q” parameter, and click Test.
If everything is set up correctly, you’ll see a green check and the full JSON response.
Use the Connector in Power Automate and Power Apps
Your custom connector now appears alongside Microsoft’s connectors when you search for “WeatherAPI”.
In Power Automate: Create a flow that triggers every day, uses the WeatherAPI connector to get the current weather for your favorite city, and sends an email summary.
In Power Apps:
Add the connector to your app. In a button’s OnSelect, call WeatherAPI.GetWeather("Tokyo", "metric").value and display the temperature in a label.
Because you defined the response schema, all properties (temperature, humidity, etc.) are available directly in formulas and expressions.
Performance and Security Notes
- API keys are stored securely in Power Platform. Use separate keys for development and production.
- If you expose the connector to other users, they will need their own connection (or you can pre‑build a connection shared via an Azure Key Vault solution).
- The OpenWeatherMap free tier has rate limits—be mindful when triggering frequent requests.
Common Pitfalls and Solutions
| Issue | Likely Cause | Fix |
|---|---|---|
| Test returns 401 Unauthorized | API key missing or wrong in the connection | Re‑create the connection with the correct key. |
| Parameters not visible after import | appid was not deleted from the Request section | Remove the parameter from the request list. |
| No dynamic output fields in Power Apps | Default response was not imported | Go back to Definition tab and import a sample response. |
| Action fails with “Not found” (404) | Base URL or Host is wrong | Verify host and base URL match exactly: api.openweathermap.org and / |
Optional: Advanced Transformations
The Code section of the connector editor allows you to inject C# logic that reshapes the API response before returning it to the caller. This is useful when you want to flatten nested JSON or rename properties. It’s not needed for this simple example, but you can explore more in the Microsoft documentation.
Final Recommendation
Custom connectors are a superpower for Power Platform developers. Start with one action and a simple API—like weather or quotes—then expand to include multiple actions or even triggers (webhooks). Because the connector is reusable across all your flows and apps, the effort pays off quickly.
References
- Original tutorial: Matthew Devaney – Make Your First Custom Connector For Power Automate And Power Apps
- OpenWeatherMap API Documentation
- Microsoft Learn – Custom connectors overview (link subject to change)