You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
description: Call REST API endpoint URLs from workflows in Azure Logic Apps by using HTTP Swagger operations.
2
+
title: Call REST APIs from Workflows with HTTP Swagger
3
+
description: Call REST API endpoints from workflows in Azure Logic Apps by using HTTP Swagger operations.
4
4
services: azure-logic-apps
5
5
ms.suite: integration
6
6
ms.reviewers: estfan, azla
@@ -11,131 +11,119 @@ ms.date: 03/23/2026
11
11
# Customer intent: As an integration developer who works with Azure Logic Apps, I want to call a REST API endpoint URL from my workflow by using HTTP Swagger operations.
12
12
---
13
13
14
-
# Call REST API endpoint URLs from workflows in Azure Logic Apps
14
+
# Call REST API endpoints from workflows in Azure Logic Apps by using HTTP Swagger
To call a REST API endpoint from a logic app workflow in Azure Logic Apps, you can use the built-in **HTTP + Swagger** operations to call any REST API endpoint through a [Swagger file](https://swagger.io). The **HTTP + Swagger** trigger and action work the same as the [HTTP trigger and action](/azure/connectors/connectors-native-http) but provide a better experience in the workflow designer by exposing the API structure and outputs described by the Swagger file. To implement a polling trigger, follow the [polling trigger pattern](/azure/logic-apps/logic-apps-create-api-app#polling-triggers).
18
+
To call a REST API from your workflow in Azure Logic Apps without manually building a request, add the native, built-in **HTTP + Swagger** trigger or action to your workflow. These operations call any REST API endpoint by using a [Swagger file](https://swagger.io) to discover callable operations and get structured inputs and outputs.
19
+
20
+
The **HTTP + Swagger** trigger and action work the same as the [HTTP trigger and action](/azure/connectors/connectors-native-http), but they provide a better experience in the workflow designer by exposing the API structure and outputs described by the Swagger file.
21
+
22
+
This article shows how to add and use the **HTTP + Swagger** trigger and action in your workflow.
19
23
20
24
## Limitations
21
25
22
26
The **HTTP + Swagger** built-in operations support only OpenAPI 2.0, not OpenAPI 3.0.
23
27
24
28
## Prerequisites
25
29
26
-
* An Azure account and subscription. [Get a free Azure account](https://azure.microsoft.com/pricing/purchase-options/azure-account?cid=msft_learn).
30
+
- An Azure account and subscription. [Get a free Azure account](https://azure.microsoft.com/pricing/purchase-options/azure-account?cid=msft_learn).
27
31
28
-
* The URL for the Swagger file that describes the target REST API endpoint that you want to call
32
+
- The URL for the Swagger file that describes the target REST API endpoint to call.
29
33
30
-
Typically, the REST endpoint must meet the following criteria for the trigger or action to work:
34
+
Typically, the REST endpoint needs to meet the following criteria for the trigger or action to work:
31
35
32
-
* The Swagger file must be hosted on an HTTPS URL that's publicly accessible.
36
+
- The Swagger file is hosted on a publicly accessible HTTPS URL.
33
37
34
-
* The Swagger file must contain an **operationID** property for each operation in the definition. If not, the connector shows only the last operation in the Swagger file.
35
-
36
-
* The Swagger file must have [Cross-Origin Resource Sharing (CORS)](/rest/api/storageservices/cross-origin-resource-sharing--cors--support-for-the-azure-storage-services) enabled.
37
-
38
-
> [!NOTE]
39
-
>
40
-
> To reference a Swagger file that's unhosted or doesn't meet security and cross-origin requirements, you can [upload the Swagger file to a blob container in an Azure storage account](#host-swagger) and enable CORS on that storage account.
41
-
42
-
* The Consumption or Standard logic app workflow from where you want to call the target endpoint. To start with the **HTTP + Swagger** trigger, create a logic app resource with a blank workflow. To use the **HTTP + Swagger** action, start your workflow with any trigger that you want. This example uses the **HTTP + Swagger** trigger as the first operation.
43
-
44
-
## Add an HTTP + Swagger trigger
45
-
46
-
This built-in trigger sends an HTTP request to a URL for a Swagger file that describes a REST API. The trigger then returns a response that contains that file's content.
38
+
- The Swagger file contains an `operationID` property for each operation in the API definition. If not, the workflow designer shows only the last operation in the Swagger file.
47
39
48
-
1. In the [Azure portal](https://portal.azure.com), open your logic app resource and blank workflow in the designer.
40
+
- The Swagger file needs to turn on [Cross-Origin Resource Sharing (CORS)](/rest/api/storageservices/cross-origin-resource-sharing--cors--support-for-the-azure-storage-services).
49
41
50
-
1. Based on whether you have a Consumption or Standard workflow, [follow these general steps to add the **HTTP** trigger named **HTTP + Swagger**](/azure/logic-apps/create-workflow-with-trigger-or-action#add-trigger).
42
+
> [!NOTE]
43
+
>
44
+
> To reference a Swagger file that's unhosted or doesn't meet security and cross-origin requirements, [upload the Swagger file to a blob container in an Azure storage account](#host-swagger), and enable CORS on that storage account.
51
45
52
-
1. In the **Swagger endpoint** box, enter the URL for the Swagger file that you want, and select **Add action**.
46
+
- A Consumption or Standard logic app workflow where you want to call the REST API endpoint.
53
47
54
-
The following example uses a non-functional Swagger URL. Your URL might use a different format.
48
+
To start your workflow with the **HTTP + Swagger** trigger, create a logic app resource that has a blank workflow. To use the **HTTP + Swagger** action, start your workflow with any trigger that works best for your business scenario.
55
49
56
-
:::image type="content" source="media/connectors-native-http-swagger/http-swagger-trigger-parameters.png" alt-text="Screenshot shows workflow designer with an Add a trigger pane for an HTTP + Swagger trigger. The Swagger endpoint property is set to an example URL.":::
50
+
## Add an HTTP + Swagger trigger
57
51
58
-
1. After the designer shows the operations described by the Swagger file, select the operation that you want to use.
52
+
This trigger sends an HTTP request to the URL for a Swagger file that describes a REST API. The trigger returns a response that contains the Swagger file content to the workflow.
59
53
60
-
1. Provide the values for the trigger parameters, which vary based on the selected operation, that you want to include in the endpoint call.
54
+
To implement a polling trigger, follow the [polling trigger pattern](/azure/logic-apps/logic-apps-create-api-app#polling-triggers).
61
55
62
-
1.If the trigger requires that you specify a firing schedule, specify the recurrence for how often you want the trigger to call the endpoint.
56
+
1.In the [Azure portal](https://portal.azure.com), open your logic app resource.
63
57
64
-
1.To add other available parameters, open the **Advanced parameters** list, and select the parameters that you want.
58
+
1.In the designer, open your blank workflow.
65
59
66
-
For more information about authentication types available for HTTP + Swagger, see [Add authentication to outbound calls](/azure/logic-apps/logic-apps-securing-a-logic-app#add-authentication-outbound).
60
+
1. Based on whether your workflow is Consumption or Standard, follow the [general steps](/azure/logic-apps/add-trigger-action-workflow#add-trigger) to add the **HTTP** trigger named **HTTP + Swagger**.
67
61
68
-
1.Continue building your workflow with the actions that you want to run when the trigger fires.
62
+
1.In the **Swagger endpoint** box, enter the URL for the Swagger file, and select **Add action**.
69
63
70
-
1. When you're done, save your workflow. On the designer toolbar, select **Save**.
64
+
The following example shows an example Swagger URL format. Your URL might use a different format.
71
65
72
-
## Add an HTTP + Swagger action
66
+
:::image type="content" source="media/connectors-native-http-swagger/http-swagger-trigger-parameters.png" alt-text="Screenshot that shows the Azure portal, workflow designer, and HTTP + Swagger trigger pane. An example URL is entered for the Swagger endpoint parameter.":::
73
67
74
-
This built-in action sends an HTTP request to the URL for the Swagger file that describes a REST API. The action then returns a response that contains that file's content.
68
+
The trigger information pane shows the operations in the Swagger file.
75
69
76
-
1.In the [Azure portal](https://portal.azure.com), open your logic app resource and workflow in the designer.
70
+
1.Select the operation you want.
77
71
78
-
1.Based on whether you have a Consumption or Standard workflow, [follow these general steps to add the **HTTP** action named **HTTP + Swagger**](/azure/logic-apps/create-workflow-with-trigger-or-action#add-action).
72
+
1.For the selected operation, enter the parameter values to use in the REST API call.
79
73
80
-
1. In the **Swagger endpoint** box, enter the URL for the Swagger file that you want, and select **Add action**.
74
+
Parameters vary based on the selected operation.
81
75
82
-
The following example uses a non-functional Swagger URL. Your URL might use a different format.
76
+
1. If the trigger runs on a schedule, set up the recurrence to specify when the trigger calls the REST API.
83
77
84
-
:::image type="content" source="media/connectors-native-http-swagger/http-swagger-action-parameters.png" alt-text="Screenshot shows workflow designer with a trigger named Fabrikam API - Check customer and an Add an action pane for an HTTP + Swagger action. The Swagger endpoint property is set to a URL.":::
78
+
1. If other parameters exist, open the **Advanced parameters** list, and select the parameters you want.
85
79
86
-
1. After the designer shows the operations described by the Swagger file, select the operation that you want to use.
80
+
For more information about authentication, see [Add authentication to outbound calls](/azure/logic-apps/logic-apps-securing-a-logic-app#add-authentication-outbound).
87
81
88
-
1.Provide the values for the action parameters, which vary based on the selected operation, that you want to include in the endpoint call.
82
+
1.Continue building the workflow with actions to run when the trigger fires.
89
83
90
-
1.To add other available parameters, open the **Advanced parameters** list, and select the parameters that you want.
84
+
1.When you finish, save your workflow. On the designer toolbar, select **Save**.
91
85
92
-
For more information about authentication types available for HTTP + Swagger, see [Add authentication to outbound calls](/azure/logic-apps/logic-apps-securing-a-logic-app#add-authentication-outbound).
86
+
## Add an HTTP + Swagger action
93
87
94
-
1. Continue building your workflow with any other actions that you want to run.
88
+
This action sends an HTTP request to the URL for a Swagger file that describes a REST API. The action returns a response that contains the Swagger file content to the workflow.
95
89
96
-
1.When you're done, save your workflow. On the designer toolbar, select **Save**.
90
+
1.In the [Azure portal](https://portal.azure.com), open your logic app resource.
97
91
98
-
<aname="host-swagger"></a>
92
+
1. In the designer, open your blank workflow.
99
93
100
-
## Host Swagger in Azure Storage
94
+
1. Based on whether your workflow is Consumption or Standard, follow the [general steps](/azure/logic-apps/add-trigger-action-workflow#add-action) to add the **HTTP** action named **HTTP + Swagger**.
101
95
102
-
You can still reference a Swagger file that's not hosted or that doesn't meet the security and cross-origin requirements. Upload the Swagger file to a blob container in an Azure storage account and enable CORS on that storage account. To create, set up, and store Swagger files in Azure Storage, follow these steps:
96
+
1. In the **Swagger endpoint** box, enter the URL for the Swagger file, and select **Add action**.
103
97
104
-
1.[Create an Azure storage account](/azure/storage/common/storage-account-create).
98
+
The following example shows an example Swagger URL format. Your URL might use a different format.
105
99
106
-
1. Enable CORS for the blob. On your storage account's **Settings** section, select **CORS**. On the **Blob service** tab, specify these values, and select **Save**.
100
+
:::image type="content" source="media/connectors-native-http-swagger/http-swagger-action-parameters.png" alt-text="Screenshot that shows the Azure portal, workflow designer, and HTTP + Swagger action pane. An example URL is entered for the Swagger endpoint parameter.":::
107
101
108
-
| Property | Value |
109
-
|----------|-------|
110
-
|**Allowed origins**|`*`|
111
-
|**Allowed methods**|`GET`, `HEAD`, `PUT`|
112
-
|**Allowed headers**|`*`|
113
-
|**Exposed headers**|`*`|
114
-
|**Max age** (in seconds) |`200`|
102
+
The action information pane shows the operations in the Swagger file.
115
103
116
-
Although this example uses the [Azure portal](https://portal.azure.com), you can also use a tool such as [Azure Storage Explorer](https://storageexplorer.com/), or automatically configure this setting by using this sample [PowerShell script](https://github.com/logicappsio/EnableCORSAzureBlob/blob/master/EnableCORSAzureBlob.ps1).
104
+
1. Select the operation you want.
117
105
118
-
1.[Create a blob container](/azure/storage/blobs/storage-quickstart-blobs-portal). On the container's **Overview** pane, select **Change access level**. From the **Public access level** list, select **Blob (anonymous read access for blobs only)**, and select **OK**.
106
+
1.For the selected operation, enter the parameter values to use in the REST API call.
119
107
120
-
1.[Upload the Swagger file to the blob container](/azure/storage/blobs/storage-quickstart-blobs-portal#upload-a-block-blob), either through the [Azure portal](https://portal.azure.com) or [Azure Storage Explorer](https://storageexplorer.com/).
108
+
Parameters vary based on the selected operation.
121
109
122
-
1.To reference the file in the blob container, get the HTTPS URL that follows this format, which is case-sensitive, from Azure Storage Explorer:
110
+
1.If other parameters exist, open the **Advanced parameters** list, and select the parameters you want.
For more information about authentication, see [Add authentication to outbound calls](/azure/logic-apps/logic-apps-securing-a-logic-app#add-authentication-outbound).
125
113
126
-
## Connector technical reference
114
+
1. Continue building the workflow with actions to run when the trigger fires.
127
115
128
-
This section provides more information about the outputs from an**HTTP + Swagger** trigger and action.
116
+
1. When you finish, save your workflow. On the designer toolbar, select**Save**.
129
117
130
-
###Outputs
118
+
## Outputs from HTTP + Swagger operations
131
119
132
-
The **HTTP + Swagger**call returns the following information:
120
+
This section provides more information about the outputs from the **HTTP + Swagger** trigger and action. The **HTTP + Swagger**operation returns the following information:
133
121
134
122
| Property name | Type | Description |
135
123
|---------------|------|-------------|
136
-
|**headers**| Object | The headers from the request |
137
-
|**body**| Object | The object with the body content from the request |
138
-
|**status code**| Integer | The status code from the request |
124
+
|**headers**| Object | The headers from the request.|
125
+
|**body**| Object | The object with the body content from the request.|
126
+
|**status code**| Integer | The status code from the request.|
139
127
140
128
| Status code | Description |
141
129
|-------------|-------------|
@@ -147,8 +135,47 @@ The **HTTP + Swagger** call returns the following information:
147
135
| 404 | Not Found |
148
136
| 500 | Internal server error. Unknown error occurred. |
149
137
150
-
## Related content
138
+
<aname="host-swagger"></a>
139
+
140
+
## Host the Swagger in Azure Storage
151
141
152
-
*[Managed connectors for Azure Logic Apps](/connectors/connector-reference/connector-reference-logicapps-connectors)
153
-
*[Built-in connectors for Azure Logic Apps](/azure/connectors/built-in)
142
+
You can still reference a Swagger file that's not hosted or that doesn't meet the security and cross-origin requirements. Upload the Swagger file to a blob container in an Azure storage account and turn on CORS on the storage account.
143
+
144
+
To create, set up, and store Swagger files in Azure Storage, follow these steps:
145
+
146
+
1. In the Azure portal, [create an Azure storage account](/azure/storage/common/storage-account-create).
147
+
148
+
1. Turn on CORS for the blob by following these steps:
149
+
150
+
1. On the storage account sidebar, under **Settings**, select **CORS**.
151
+
152
+
1. On the **Blob service** tab, enter the following values, and select **Save**.
153
+
154
+
| Parameter | Value |
155
+
|-----------|-------|
156
+
|**Allowed origins**|`*`|
157
+
|**Allowed methods**|`GET`, `HEAD`, `PUT`|
158
+
|**Allowed headers**|`*`|
159
+
|**Exposed headers**|`*`|
160
+
|**Max age** in seconds |`200`|
161
+
162
+
This example uses the Azure portal, but you can use a tool like [Azure Storage Explorer](https://storageexplorer.com/) to configure this setting. To automate configuration, see the [sample PowerShell script](https://github.com/logicappsio/EnableCORSAzureBlob/blob/master/EnableCORSAzureBlob.ps1).
163
+
164
+
1.[Create a blob container](/azure/storage/blobs/storage-quickstart-blobs-portal) and follow these steps:
165
+
166
+
1. On the container sidebar, select **Overview**.
167
+
168
+
1. On the **Overview** page, select **Change access level**.
169
+
170
+
1. From the **Public access level** list, select **Blob (anonymous read access for blobs only)**, and then select **OK**.
171
+
172
+
1. In the Azure portal or Azure Storage Explorer, [upload the Swagger file to the blob container](/azure/storage/blobs/storage-quickstart-blobs-portal#upload-a-block-blob).
173
+
174
+
1. To reference the file in the blob container, from Azure Storage Explorer, get the HTTPS URL that uses the following case-sensitive format:
0 commit comments