Calling REST APIs and Azure Functions from Logic Apps
Logic Apps can call any REST API or Azure Function using the built-in HTTP action or dedicated connectors. This tutorial covers how to make HTTP requests, authenticate, parse responses, and handle errors.
HTTP Action
The HTTP action lets you call any REST endpoint with standard methods:
- GET – Retrieve data from an API
- POST – Send data to create a resource
- PUT – Update an existing resource
- DELETE – Remove a resource

To add an HTTP action:
- Click + New step in the designer
- Search for HTTP and select the built-in HTTP action
- Choose the method (GET, POST, PUT, DELETE)
- Enter the URI of the API endpoint
Setting Headers
Headers are configured in the HTTP action's Headers section. Common headers include:
| Header | Purpose |
|---|---|
Authorization | Bearer token, API key, or Basic credentials |
Content-Type | application/json, application/xml, etc. |
Accept | Expected response format |
| Custom headers | Any application-specific headers |

Authentication Options
The HTTP action supports multiple authentication types:
| Type | Use Case |
|---|---|
| None | Public APIs with no auth |
| Basic | Username/password authentication |
| OAuth 2.0 (Active Directory) | Azure AD-protected APIs |
| Managed Identity | Azure resources without storing credentials |
| API Key | APIs that use key-based auth via header or query param |
To configure authentication:
- Expand the Authentication dropdown in the HTTP action
- Select the authentication type
- Fill in the required fields (tenant ID, client ID, secret, etc.)

Parsing API Responses
After an HTTP call, use Parse JSON to work with the response body:
- Add a Parse JSON action after the HTTP step
- Set Content to the HTTP action's
bodyoutput - Provide a JSON schema (click Generate from sample to auto-generate)
Once parsed, individual fields are available as dynamic content in subsequent steps.

Calling Azure Functions
You have two options for calling Azure Functions:
Built-in Azure Functions Connector
- Automatically discovers functions in your subscription
- Handles authentication via function keys
- Provides a streamlined configuration experience
HTTP Action
- More control over headers, authentication, and timeout
- Required when using Managed Identity authentication
- Works with functions in other subscriptions or tenants

Step-by-Step: Call a Public REST API
This example calls the JSONPlaceholder API to fetch a post and store the title in a variable.
1. Initialize a Variable
- Add Initialize variable action
- Name:
PostTitle - Type: String
2. Add HTTP GET Action
- Add an HTTP action
- Method: GET
- URI:
https://jsonplaceholder.typicode.com/posts/1 - Headers:
Accept: application/json

3. Parse the Response
- Add Parse JSON action
- Content:
@body('HTTP') - Schema:
{
"type": "object",
"properties": {
"userId": { "type": "integer" },
"id": { "type": "integer" },
"title": { "type": "string" },
"body": { "type": "string" }
}
}
4. Store in Variable
- Add Set variable action
- Name:
PostTitle - Value: Select
titlefrom Parse JSON dynamic content

Step-by-Step: Call an Azure Function with Managed Identity
Prerequisites
- A Logic App with a system-assigned or user-assigned Managed Identity enabled
- An Azure Function with Azure AD authentication configured
- The Logic App's identity granted access to the Function App
1. Enable Managed Identity on the Logic App
- Go to Logic App → Identity → System assigned → set Status to On
- Copy the Object ID for role assignment
2. Configure the Azure Function for AD Auth
- Go to Function App → Authentication → Add identity provider
- Select Microsoft and configure the App Registration
3. Grant Access
- Assign the Logic App's managed identity the appropriate role on the Function App (e.g., via Azure RBAC or the Function App's App Registration)
4. Add HTTP Action in Logic App
- Add an HTTP action
- Method: POST
- URI:
https://your-function-app.azurewebsites.net/api/YourFunction - Headers:
Content-Type: application/json - Body: your request payload
- Authentication:
- Type: Managed Identity
- Audience:
https://your-function-app.azurewebsites.net

Handling API Errors
Status Code Handling
Use Configure run after to branch logic based on success or failure:
- Add actions after the HTTP step
- Click ... → Configure run after
- Select conditions: is successful, has failed, is skipped, has timed out
Common status codes to handle:
| Code | Meaning | Action |
|---|---|---|
| 200/201 | Success | Continue workflow |
| 400 | Bad request | Log error, notify |
| 401/403 | Auth failure | Refresh token, retry |
| 404 | Not found | Handle gracefully |
| 429 | Rate limited | Wait and retry |
| 500+ | Server error | Retry with backoff |
Retry Policy
Configure retries directly on the HTTP action:
- Click ... → Settings on the HTTP action
- Under Retry Policy, choose:
- Default – 4 retries with exponential backoff
- Fixed interval – set count and interval
- Exponential interval – set min/max interval and count
- None – no retries

Timeout Configuration
Set a timeout on the HTTP action to avoid long-running calls blocking your workflow:
- Click ... → Settings on the HTTP action
- Set Timeout using ISO 8601 duration format (e.g.,
PT30Sfor 30 seconds,PT2Mfor 2 minutes)
The default timeout is 100 seconds. For long-running APIs, consider using the asynchronous polling pattern (the API returns 202 with a Location header).

| Previous | Next |
|---|---|
| Error Handling | Stateful vs Stateless |