title | description | services | ms.service | ms.suite | author | ms.author | ms.reviewer | ms.assetid | tags | ms.topic | ms.date |
---|---|---|---|---|---|---|---|---|---|---|---|
Call REST endpoints from Azure Logic Apps | Microsoft Docs |
Automate tasks and workflows that communicate with REST endpoints by using the HTTP + Swagger connector in Azure Logic Apps |
logic-apps |
logic-apps |
integration |
ecfan |
estfan |
klam, jehollan, LADocs |
eccfd87c-c5fe-4cf7-b564-9752775fd667 |
connectors |
article |
07/18/2016 |
You can create a first-class connector to any REST endpoint through a Swagger document when you use the HTTP + Swagger action in your logic app workflow. You can also extend logic apps to call any REST endpoint with a first-class Logic App Designer experience.
To learn how to create logic apps with connectors, see Create a new logic app.
The HTTP + Swagger trigger and action work the same as the HTTP action but provide a better experience in Logic App Designer by exposing the API structure and outputs from the Swagger metadata. You can also use the HTTP + Swagger connector as a trigger. If you want to implement a polling trigger, follow the polling pattern that's described in Create custom APIs to call other APIs, services, and systems from logic apps.
Learn more about logic app triggers and actions.
Here's an example of how to use the HTTP + Swagger operation as an action in a workflow in a logic app.
-
Select the New Step button.
-
Select Add an action.
-
In the action search box, type swagger to list the HTTP + Swagger action.
-
Type the URL for a Swagger document:
- To work from the Logic App Designer, the URL must be an HTTPS endpoint and have CORS enabled.
- If the Swagger document doesn't meet this requirement, you can use Azure Storage with CORS enabled to store the document.
-
Click Next to read and render from the Swagger document.
-
Add in any parameters that are required for the HTTP call.
-
To save and publish your logic app, click Save on designer toolbar.
You might want to reference a Swagger document that's not hosted, or that doesn't meet the security and cross-origin requirements for the designer. To resolve this issue, you can store the Swagger document in Azure Storage and enable CORS to reference the document.
Here are the steps to create, configure, and store Swagger documents in Azure Storage:
-
Create an Azure storage account with Azure Blob storage. To perform this step, set permissions to Public Access.
-
Enable CORS on the blob.
To automatically configure this setting, you can use this PowerShell script.
-
Upload the Swagger file to the blob.
You can perform this step from the Azure portal or from a tool like Azure Storage Explorer.
-
Reference an HTTPS link to the document in Azure Blob storage.
The link uses this format:
https://*storageAccountName*.blob.core.windows.net/*container*/*filename*
Following are the details for the triggers and actions that this HTTP + Swagger connector supports.
A trigger is an event that can be used to start the workflow that's defined in a logic app. Learn more about triggers. The HTTP + Swagger connector has one trigger.
Trigger | Description |
---|---|
HTTP + Swagger | Make an HTTP call and return the response content |
An action is an operation that's carried out by the workflow that's defined in a logic app. Learn more about actions. The HTTP + Swagger connector has one possible action.
Action | Description |
---|---|
HTTP + Swagger | Make an HTTP call and return the response content |
The HTTP + Swagger connector comes with one possible action. Following is information about each of the actions, their required and optional input fields, and the corresponding output details that are associated with their usage.
Make an HTTP outbound request with assistance of Swagger metadata. An asterisk (*) means a required field.
Display name | Property name | Description |
---|---|---|
Method* | method | HTTP verb to use. |
URI* | uri | URI for the HTTP request. |
Headers | headers | A JSON object of HTTP headers to include. |
Body | body | The HTTP request body. |
Authentication | authentication | Authentication to use for request. For more information, see the HTTP connector. |
Output details
HTTP response
Property Name | Data type | Description |
---|---|---|
Headers | object | Response headers |
Body | object | Response object |
Status Code | int | HTTP status code |
When making calls to various actions, you might get certain responses. Following is a table that outlines corresponding responses and descriptions.
Name | Description |
---|---|
200 | OK |
202 | Accepted |
400 | Bad request |
401 | Unauthorized |
403 | Forbidden |
404 | Not Found |
500 | Internal server error. Unknown error occurred. |