HTTP Actions in Cloud and Desktop Flows
Earn 25 points (50 with Pro) in two steps
- ① Read through the lesson — each section gets a ✓ as you scroll through it.
- ② When every section has a ✓, tap Complete lesson.
0 of 11 read · keep scrolling
✦ See fewer ads and earn double points — 50 a lesson instead of 25 — with Pro
Lesson: Mastering HTTP Actions in Power Automate Cloud and Desktop Flows
Introduction: Bridging the Gap with HTTP
In the world of workflow automation, we often find ourselves hitting a wall when the built-in connectors provided by a platform—such as Power Automate—do not support a specific application or a unique API endpoint. While pre-built connectors for Office 365, Salesforce, or Twitter are convenient, they are inherently limited by the scope defined by the connector developer. This is where the HTTP action becomes the ultimate tool in your automation arsenal.
The HTTP action allows you to send web requests directly to any service that exposes a REST or SOAP API. By mastering this action, you stop relying on what the platform provides and start defining what the platform can do. Whether you need to pull data from a custom internal database, trigger a process in a legacy system, or communicate with a modern cloud-native microservice, HTTP actions provide the universal language of the web. Understanding how to construct, authenticate, and process these requests is the difference between a basic user and an automation architect.
Not read yet
Understanding the Anatomy of an HTTP Request
To use HTTP actions effectively, you must understand the fundamental structure of a request. Every HTTP request consists of several key components that tell the receiving server what you want to do and how you want to do it. If any of these components are misconfigured, the request will fail, often with cryptic error messages that are difficult to debug.
The Core Components
- Method (Verb): This defines the action you want to perform. The most common methods are GET (retrieve data), POST (send new data), PUT/PATCH (update existing data), and DELETE (remove data).
- URI (Uniform Resource Identifier): This is the web address of the resource you are interacting with. It often includes query parameters that filter or sort the data you are requesting.
- Headers: These act as metadata for your request. They provide information about the format of the data (Content-Type), the identity of the requester (Authorization), and other operational details.
- Body (Payload): This is the actual data you are sending, typically formatted as JSON (JavaScript Object Notation). This is required for POST and PUT requests but is generally omitted for GET and DELETE requests.
- Authentication: Most modern APIs require proof of identity. This can be handled via API keys in the header, Basic Authentication, or OAuth 2.0.
Callout: HTTP Actions vs. Pre-built Connectors Pre-built connectors are wrappers around HTTP requests. They simplify the process by hiding the API documentation, managing authentication, and parsing the JSON responses for you. However, they are static. HTTP actions are dynamic; they give you access to the entire API surface area, including features that the connector vendor may not have implemented yet. Always check for a connector first, but do not hesitate to use HTTP when the connector falls short.
Not read yet
Implementing HTTP Actions in Cloud Flows
In Power Automate Cloud Flows, the HTTP action is a "Premium" feature. This means your environment must have the appropriate licensing, and the flow owner must have a per-user or per-flow license. Once you have confirmed your licensing, you can add the HTTP action to your designer.
Step-by-Step: Sending a GET Request
- Add the Action: Search for "HTTP" in the action picker and select the "HTTP" action (the standard one, not the HTTP with Azure AD unless specifically required).
- Configure the Method: Choose "GET" from the Method dropdown.
- Enter the URI: Paste the API endpoint URL here. If you need to send dynamic data, you can use expressions to build the string (e.g.,
concat('https://api.example.com/users/', triggerBody()?['ID'])). - Set Headers: If the API requires a specific format, such as
Accept: application/json, add these in the Headers section. - Authentication: Choose the appropriate authentication type. "Basic" requires a username and password, while "API Key" usually involves adding a header like
X-API-Key. - Test: Save the flow and run a test. Inspect the "Outputs" section of the action to see the status code (e.g., 200 OK) and the response body.
Handling JSON Payloads
When performing a POST or PUT request, you will often need to send a JSON object. Power Automate makes this easy by allowing you to type the JSON directly into the "Body" field.
{
"firstName": "John",
"lastName": "Doe",
"email": "[email protected]",
"isActive": true
}
If you need to include dynamic data from previous steps, you can use the Dynamic Content selector or write expressions directly within the JSON structure.
Note: When writing JSON in the body of an HTTP action, ensure that you use double quotes for keys and string values. Single quotes will cause a syntax error in the API request, leading to a 400 Bad Request response.
Not read yet
HTTP Actions in Power Automate Desktop (PAD)
Power Automate Desktop (PAD) also features HTTP capabilities, though the implementation differs slightly from the cloud version. In PAD, the action is titled "Invoke web service." This action is highly robust and allows for more granular control over the request, including the ability to handle complex file uploads and specific proxy configurations.
Key Features of "Invoke Web Service" in PAD
- Method Selection: Supports GET, POST, PUT, PATCH, DELETE, HEAD, and OPTIONS.
- Advanced Headers: You can define custom headers easily in a key-value format.
- Request Body: You can paste text or even select a file to be sent as the body content.
- Response Storage: The response is stored in a variable (usually named
%WebServiceName%), which contains the status code, the headers, and the response body.
Practical Example: Fetching Data in PAD
If you are automating a desktop process that needs to fetch a report from an internal server, you would:
- Drag the "Invoke web service" action onto the canvas.
- Set the "URL" to your endpoint.
- Set the "Method" to GET.
- In the "Advanced" section, you can set the "Accept" header to
application/json. - After the action runs, you can use the "Convert JSON to custom object" action to turn the string response into a variable you can interact with using standard PAD logic (e.g.,
%WebResponse['name']%).
Tip: When debugging in PAD, always print the
%WebServiceNameStatusCode%and%WebServiceName%variables to the console or a message box. If the status code is anything other than 200 or 201, the body will often contain a detailed error message from the server that explains exactly why the request failed.
Not read yet
Authentication Strategies
Authentication is frequently the most challenging part of implementing HTTP actions. APIs rarely allow open access, and for good reason. There are three primary methods you will encounter in your automation journey.
1. API Keys
This is the simplest form of authentication. You are provided with a long string of characters that you include in the header of every request.
- Implementation: Add a header like
Authorization: Bearer YOUR_API_KEYorX-API-Key: YOUR_API_KEY. - Risk: If your API key is hardcoded into the flow, anyone with access to the flow can steal it. Use "Secure Inputs/Outputs" in the action settings to prevent these values from appearing in the run history logs.
2. Basic Authentication
This involves sending your username and password encoded in Base64. Power Automate has a built-in dropdown for "Basic" authentication where you enter your credentials, and the platform handles the encoding automatically.
3. OAuth 2.0
This is the industry standard for secure API access. It involves a "handshake" where your flow requests an access token from an identity provider (like Microsoft Entra ID) and then uses that token to access the API.
- Process: First, you perform a POST request to an identity URL with your Client ID and Client Secret.
- Response: The server returns an
access_token. - Usage: You then use this token in the
Authorizationheader for all subsequent requests until it expires.
Not read yet
Common Pitfalls and How to Avoid Them
Even experienced developers encounter issues when working with HTTP actions. By anticipating these common mistakes, you can save hours of troubleshooting time.
1. Forgetting the Content-Type Header
Many APIs will reject your request if they do not know what kind of data you are sending. Always include the header Content-Type: application/json when sending a body. Without it, the server might try to parse your request as plain text or XML, leading to an error.
2. Ignoring Status Codes
A common mistake is assuming that if the flow action doesn't "fail" (turn red), the request was successful. Sometimes an API will return a 400 (Bad Request) or a 404 (Not Found), but the HTTP action will still report a "Success" status because it successfully communicated with the server. Always add a "Condition" step after your HTTP action to check if the status code is 200 or 201.
3. Hardcoding Sensitive Data
Never hardcode API keys, passwords, or client secrets directly into the HTTP action configuration. If you do, they will be visible in the flow's run history. Instead, use "Environment Variables" or "Azure Key Vault" to store these secrets and reference them dynamically in your flows.
4. Overlooking Rate Limits
Most public APIs have strict rate limits (e.g., 100 requests per minute). If your loop hits an API too quickly, your account may be temporarily banned or blocked. Always implement a "Delay" action or use "Concurrency Control" in your loops to throttle the number of requests you are making.
Not read yet
Best Practices for Professional Automation
To maintain a clean and scalable automation environment, follow these industry standards when working with HTTP actions.
Use Descriptive Naming
Do not leave your actions named "HTTP" or "HTTP 2". Rename them to reflect their purpose, such as "GET Customer Details" or "POST Invoice to ERP". This makes the flow much easier to troubleshoot when you return to it months later.
Implement Error Handling
Wrap your HTTP actions in a "Scope" block. Use the "Configure Run After" setting on the subsequent action to handle failures. This allows you to send a notification to yourself or an administrator if the API call fails, rather than letting the flow silently fail or crash.
Parse JSON Responses
After receiving a response, use the "Parse JSON" action. This allows you to generate a schema based on a sample response. Once parsed, you can use the resulting dynamic content in subsequent steps, which is much safer and cleaner than using expressions to extract data from the raw response body.
Warning: Never use "Parse JSON" on untrusted input without validating the schema. While internal APIs are generally safe, if you are calling a public API, ensure your schema is robust enough to handle unexpected null values or missing fields without breaking your entire workflow.
Not read yet
Comparison Table: HTTP Actions in Cloud vs. Desktop
| Feature | Power Automate Cloud | Power Automate Desktop |
|---|---|---|
| Licensing | Requires Premium License | Included in Attended/Unattended |
| Authentication | Built-in UI for OAuth/Basic | Requires manual header setup |
| Debugging | Run History (Visual) | Console/Variable Pane (Local) |
| Proxy Support | Limited (Gateway required) | Native system proxy settings |
| Payload Size | Up to 100MB | Limited by system RAM |
Advanced Techniques: Handling Pagination
A common challenge when using GET requests is dealing with APIs that limit the number of items returned per request. If you need to retrieve 5,000 records but the API only returns 100 at a time, you must implement pagination.
- Initialize a variable: Create a variable to track the current "page" or "offset".
- Use a "Do Until" loop: Continue the loop as long as the API returns data.
- Update the URI: Use an expression to append the page number to your URI:
concat('https://api.example.com/items?page=', variables('PageNumber')). - Increment: At the end of the loop, increment your
PageNumbervariable. - Exit Condition: Break the loop when the response array is empty or the "next_page" field in the response is null.
Not read yet
Managing Complex Authentication Flows
If you are working with an API that requires OAuth 2.0, you can automate the token acquisition process. Instead of manually updating a token every hour, create a "Child Flow" or a "Subflow" that handles the authentication logic.
- Logic: Check if your
AccessTokenvariable is empty or expired. - Action: If it is, perform the POST request to the identity provider to get a new token.
- Storage: Store the token in a variable.
- Execution: Use this variable in the
Authorizationheader of your main HTTP requests.
This modular approach ensures that you only write the authentication logic once, and you can reuse it across multiple flows within your environment.
Security Considerations
Security should never be an afterthought. When you use HTTP actions, you are effectively opening a door from your internal network to the outside world.
- Use HTTPS only: Never communicate with an API over standard HTTP. Ensure all URLs start with
https://to encrypt the data in transit. - Validate Inputs: If you are using data from an HTTP response to trigger other actions (like creating a file or sending an email), ensure the input is sanitized.
- Audit Trails: Enable logging for your flows to keep track of who is running these automations and what data is being accessed.
Not read yet
Troubleshooting Common HTTP Status Codes
Understanding status codes is vital for effective troubleshooting. If your flow fails, look at the "Status Code" in the output:
- 200 OK: Everything worked as expected.
- 201 Created: A new resource was successfully created.
- 400 Bad Request: The server couldn't understand your request (usually a syntax error in your JSON body).
- 401 Unauthorized: Your API key or token is invalid or missing.
- 403 Forbidden: You have authenticated correctly, but you do not have permission to access the specific resource.
- 404 Not Found: The URL you provided does not exist.
- 429 Too Many Requests: You are hitting the rate limit; add a delay.
- 500 Internal Server Error: The problem is on the API's end; try again later.
When to Avoid HTTP Actions
While HTTP actions are powerful, they are not always the right choice. If a pre-built connector exists, use it. Connectors handle:
- Automatic Pagination: You don't have to write "Do Until" loops.
- Token Refresh: The connector manages the OAuth handshake for you.
- Schema Mapping: You don't have to manually parse JSON.
- Triggering: Connectors can often trigger flows based on events (e.g., "When a new item is created"), whereas HTTP actions are primarily for polling or manual triggers.
Only use HTTP actions when you have exhausted all other options or when the pre-built connector is missing a specific, necessary function.
Not read yet
Key Takeaways
- Universality: HTTP actions allow Power Automate to interact with any system that has an API, removing the limitations of pre-built connectors.
- Structural Integrity: Every request requires a Method, URI, Headers, and (optionally) a Body. Failure to format these correctly is the most common cause of errors.
- Security First: Never hardcode credentials in your flows. Utilize secure inputs/outputs and environment variables to protect sensitive API keys and secrets.
- Status Code Awareness: Always check the status code of a response. Do not assume that a "successful" flow execution means the API request was successful.
- Throttling and Limits: Respect API rate limits to avoid being blocked. Use delays or concurrency controls to keep your automation traffic within acceptable bounds.
- Modular Logic: Use subflows or child flows to manage complex authentication (OAuth) so you can reuse the logic across your automation ecosystem.
- Maintenance: Rename your actions and document your API calls. A well-labeled HTTP action is much easier to maintain and troubleshoot than a generic one.
By following these principles, you will be able to build robust, secure, and highly capable automation solutions that can integrate with almost any technology stack in existence today. Keep experimenting, keep testing, and always refer to the API documentation of the service you are trying to automate—it is your most valuable resource.
Not read yet
Each section gets a ✓ as you scroll through it. Tap the button to jump to the next one.
- Leveraging the Power Automate Ecosystem
- Leveraging the Power Automate Ecosystem Quiz5q
- Cloud Flows vs Desktop Flows
- Cloud Flows vs Desktop Flows Quiz5q
- Designing Desktop and Cloud Flow Automations
- Designing Desktop and Cloud Flow Automations Quiz5q
- Trigger Types for Cloud Flows
- Trigger Types for Cloud Flows Quiz5q
- Target Application and Browser Interactions
- Target Application and Browser Interactions Quiz5q
- Methods for Running Desktop Flows
- Methods for Running Desktop Flows Quiz5q
- Concurrent Flow Execution
- Concurrent Flow Execution Quiz5q
- Attended vs Unattended Desktop Flows
- Attended vs Unattended Desktop Flows Quiz5q
- HTTP Actions in Cloud and Desktop Flows
- HTTP Actions in Cloud and Desktop Flows Quiz5q
- Work Queues for Automation
- Work Queues for Automation Quiz5q
- Designing Custom Actions
- Designing Custom Actions Quiz5q
- Cloud Flow Calling Desktop Flow
- Cloud Flow Calling Desktop Flow Quiz5q
- Child Cloud Flows and Data Passing
- Child Cloud Flows and Data Passing Quiz5q
- External API Calls in Cloud Flows
- External API Calls in Cloud Flows Quiz5q
- Trigger Conditions and Concurrency
- Trigger Conditions and Concurrency Quiz5q
- Timeout and Retry Policies
- Timeout and Retry Policies Quiz5q
- Data Objects and Operations in Cloud Flows
- Data Objects and Operations in Cloud Flows Quiz5q
- Text Parsing JSON XML CSV
- Text Parsing JSON XML CSV Quiz5q
- UI Options in Desktop Flows
- UI Options in Desktop Flows Quiz5q
- Datatables Lists and Custom Objects
- Datatables Lists and Custom Objects Quiz5q
- Subflows in Desktop Flows
- Subflows in Desktop Flows Quiz5q
- External APIs in Desktop Flows
- External APIs in Desktop Flows Quiz5q
- Timeout and Retry in Desktop Flows
- Timeout and Retry in Desktop Flows Quiz5q
- Custom Actions in Desktop Flows
- Custom Actions in Desktop Flows Quiz5q
- Flow Control and Loops
- Flow Control and Loops Quiz5q
- Expressions in Cloud Flows
- Expressions in Cloud Flows Quiz5q
- Variable Actions for Flows
- Variable Actions for Flows Quiz5q
- Secure Input and Output Data
- Secure Input and Output Data Quiz5q
- Desktop Flow Priority and Queues
- Desktop Flow Priority and Queues Quiz5q
- Exception Handling Blocks
- Exception Handling Blocks Quiz5q
- Business Exception Error Handling
- Business Exception Error Handling Quiz5q
- Work Queues in Flows
- Work Queues in Flows Quiz5q
- Building a Custom Connector
- Building a Custom Connector Quiz5q
- Custom Connector Authentication
- Custom Connector Authentication Quiz5q
- Custom Connector Policy Templates
- Custom Connector Policy Templates Quiz5q
- Code in Custom Connectors
- Code in Custom Connectors Quiz5q
- Credential Management Practices
- Credential Management Practices Quiz5q
- On-Premises Data Gateway
- On-Premises Data Gateway Quiz5q
- Dataverse Solutions Components
- Dataverse Solutions Components Quiz5q
- Machine and Machine Group Requirements
- Machine and Machine Group Requirements Quiz5q
- Machine Registration Management
- Machine Registration Management Quiz5q
- Machine Group Management
- Machine Group Management Quiz5q
- Load Balancing Desktop Flows
- Load Balancing Desktop Flows Quiz5q
- Run Queue Operations
- Run Queue Operations Quiz5q
- Analyzing Flow Run History
- Analyzing Flow Run History Quiz5q
- Power Automate Analytics Dashboard
- Power Automate Analytics Dashboard Quiz5q
- Desktop Flow Monitoring
- Desktop Flow Monitoring Quiz5q
- Automation Performance Optimization
- Automation Performance Optimization Quiz5q
- Troubleshooting Flow Failures
- Troubleshooting Flow Failures Quiz5q
- Center of Excellence RPA Analytics
- Center of Excellence RPA Analytics Quiz5q
No PL-500 practice exam yet
Your points already work on 76 Amazon, CompTIA and Microsoft exams.
See the exams