Using the HTTP Request Action in Power Automate – A Complete Guide
The HTTP Request action in Power Automate is a powerful feature that allows you to interact with external APIs, send and receive data, and automate processes between different services. Whether you need to fetch data from an API, send information to a web service, integrate third-party platforms, or handle authentication, the HTTP Request action enables seamless connectivity.
🔹 Step 1: Understanding HTTP Request Action
What is an HTTP Request?
An HTTP (HyperText Transfer Protocol) request is a way for applications to communicate over the internet using different methods:
Method | Description |
---|---|
GET | Retrieves data from a server |
POST | Sends new data to a server |
PUT | Updates existing data on a server |
DELETE | Removes data from a server |
Why Use the HTTP Request Action in Power Automate?
✔ Connect to third-party APIs (Google, Azure, SharePoint, Salesforce, etc.)
✔ Fetch external data (weather, stock prices, customer details)
✔ Send data to external services (logs, analytics, automation)
✔ Automate integrations between Microsoft PowerApps, Power Automate, and APIs
✔ Handle authentication methods (API Key, OAuth, Basic Auth)
🔹 Step 2: Setting Up an HTTP Request in Power Automate
Step 2.1: Open Power Automate
- Go to Power Automate → https://flow.microsoft.com
- Click Create → Instant Cloud Flow
- Choose Manually trigger a flow → Click Create
🔹 Step 3: Adding an HTTP Request Action
Step 3.1: Add the HTTP Action
- Click + New Step
- Search for “HTTP”
- Select “HTTP – HTTP” action
Step 3.2: Configure the HTTP Action Parameters
Parameter | Description |
---|---|
Method | Choose GET , POST , PUT , or DELETE |
URI | The API endpoint URL |
Headers | Additional information such as authorization |
Body | JSON data (for POST or PUT requests) |
Example: GET Request to Fetch Data
Parameter | Value |
---|---|
Method | GET |
URI | https://jsonplaceholder.typicode.com/users/1 |
Headers | (Leave blank for open APIs) |
Body | (Not required for GET) |
🔹 Step 4: Handling Authentication
Many APIs require authentication to ensure secure access.
Step 4.1: Using an API Key (Most Common)
- Obtain an API Key from the service provider
- Add it in the Headers section:
Authorization: Bearer YOUR_API_KEY
- Example API with API Key:
URI: https://api.example.com/data Headers: {"Authorization": "Bearer 123456789"}
Step 4.2: Using Basic Authentication
Some APIs require a username and password:
- Select Basic Authentication
- Enter Username and Password
Step 4.3: Using OAuth 2.0 Authentication
For services like Microsoft Graph API, Google APIs, or Azure, OAuth 2.0 is required.
- Register an App in Azure or Google API Console
- Get Client ID and Client Secret
- Obtain an Access Token and pass it in the Headers:
Authorization: Bearer YOUR_ACCESS_TOKEN
🔹 Step 5: Making Different Types of API Calls
5.1: GET Request – Fetch Data
A GET
request retrieves information from an API.
Example: Fetch User Data
Parameter | Value |
---|---|
Method | GET |
URI | https://jsonplaceholder.typicode.com/users/1 |
✅ Expected Response (JSON)
{
"id": 1,
"name": "John Doe",
"email": "john.doe@example.com"
}
5.2: POST Request – Send Data
A POST
request sends new data to a server.
Example: Create a New User
Parameter | Value |
---|---|
Method | POST |
URI | https://jsonplaceholder.typicode.com/users |
Headers | {"Content-Type": "application/json"} |
Body |
{
"name": "Jane Doe",
"email": "jane.doe@example.com"
}
✅ Expected Response
{
"id": 2,
"name": "Jane Doe",
"email": "jane.doe@example.com"
}
5.3: PUT Request – Update Data
A PUT
request updates an existing record.
Example: Update User Details
Parameter | Value |
---|---|
Method | PUT |
URI | https://jsonplaceholder.typicode.com/users/1 |
Headers | {"Content-Type": "application/json"} |
Body |
{
"name": "John Smith",
"email": "john.smith@example.com"
}
✅ Expected Response
{
"id": 1,
"name": "John Smith",
"email": "john.smith@example.com"
}
5.4: DELETE Request – Remove Data
A DELETE
request removes a record from a server.
Example: Delete User
Parameter | Value |
---|---|
Method | DELETE |
URI | https://jsonplaceholder.typicode.com/users/1 |
✅ Expected Response
{
"message": "User deleted successfully"
}
🔹 Step 6: Handling API Responses in Power Automate
After calling an API, Power Automate provides a response body.
6.1: Parse JSON Response
To extract specific data from the response:
- Add the “Parse JSON” action
- Select “Content” → Choose
Body
from the previous HTTP step - Click “Generate Schema” → Paste sample JSON response
- Power Automate will now recognize fields like name, email, etc.
🔹 Step 7: Using HTTP Response in PowerApps
If you want to use API data in PowerApps, return it as an output.
Example: Return API Data to PowerApps
- Add “Respond to PowerApps” action
- Click “Add an output” → Select Text
- Set
"APIResponse"
to Body of the HTTP request - Save & test
✅ PowerApps Formula to Call API
Set(response, 'FlowName'.Run());
Set(parsedData, ParseJSON(response.APIResponse));
🔹 Step 8: Best Practices for Using HTTP Action in Power Automate
✔ Use environment variables for API URLs & Keys
✔ Handle API errors with “Try-Catch” in Power Automate
✔ Avoid making too many API calls – use caching
✔ Secure sensitive data (avoid exposing API keys in flows)
✔ Test API responses with Postman before adding them to Power Automate
🎯 Conclusion
The HTTP Request action in Power Automate allows seamless integration with external services, databases, and automation workflows. By using GET, POST, PUT, DELETE requests, handling authentication, and parsing responses, you can create powerful API-driven automations.
Would you like help with a specific API integration? Let me know!