Thursday, March 9, 2023

How to Deploy your API as a web app or API app

 Before you can call your custom API from a logic app workflow, deploy your API as a web app or API app to Azure App Service. To make your Swagger document readable by your workflow, set the API definition properties and turn your web app or API app.

1.      In the Azure portal, select your web app or API app.

2.      In the app menu that opens, under API, select API definition. Set the API definition location to the URL for your swagger.json file.

Usually, the URL appears in this format: https://{name}.azurewebsites.net/swagger/docs/v1)


3.      Under API, select CORS. Set the CORS policy for Allowed origins to '*' (allow all).

This setting permits requests from the workflow designer.


Call your custom API from logic app workflows

After you set up the API definition properties and CORS, your custom API's triggers and actions should be available for you to include in your logic app workflow.

·       To view websites that have OpenAPI URLs, you can browse your subscription websites in the workflow designer.

·       To view available actions and inputs by pointing at a Swagger document, use the HTTP + Swagger action.

·       To call any API, including APIs that don't have or expose a Swagger document, you can always create a request with the HTTP action.

 


No comments:

Post a Comment

How to Deploy your API as a web app or API app

  Before you can call your custom API from a logic app workflow, deploy your API as a web app or API app to Azure App Service. To make your ...