Using the HTTP Request Action in Power Automate

Loading

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:

MethodDescription
GETRetrieves data from a server
POSTSends new data to a server
PUTUpdates existing data on a server
DELETERemoves 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

  1. Go to Power Automatehttps://flow.microsoft.com
  2. Click CreateInstant Cloud Flow
  3. Choose Manually trigger a flow → Click Create

🔹 Step 3: Adding an HTTP Request Action

Step 3.1: Add the HTTP Action

  1. Click + New Step
  2. Search for “HTTP”
  3. Select “HTTP – HTTP” action

Step 3.2: Configure the HTTP Action Parameters

ParameterDescription
MethodChoose GET, POST, PUT, or DELETE
URIThe API endpoint URL
HeadersAdditional information such as authorization
BodyJSON data (for POST or PUT requests)

Example: GET Request to Fetch Data

ParameterValue
MethodGET
URIhttps://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)

  1. Obtain an API Key from the service provider
  2. Add it in the Headers section: Authorization: Bearer YOUR_API_KEY
  3. 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:

  1. Select Basic Authentication
  2. 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.

  1. Register an App in Azure or Google API Console
  2. Get Client ID and Client Secret
  3. 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

ParameterValue
MethodGET
URIhttps://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

ParameterValue
MethodPOST
URIhttps://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

ParameterValue
MethodPUT
URIhttps://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

ParameterValue
MethodDELETE
URIhttps://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:

  1. Add the “Parse JSON” action
  2. Select “Content” → Choose Body from the previous HTTP step
  3. Click “Generate Schema” → Paste sample JSON response
  4. 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

  1. Add “Respond to PowerApps” action
  2. Click “Add an output” → Select Text
  3. Set "APIResponse" to Body of the HTTP request
  4. 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!

Leave a Reply

Your email address will not be published. Required fields are marked *