{"id":110779,"date":"2016-12-01T09:14:47","date_gmt":"2016-12-01T17:14:47","guid":{"rendered":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/power-automate\/custom-web-api-as-custom-api\/"},"modified":"2016-12-01T09:14:47","modified_gmt":"2016-12-01T17:14:47","slug":"custom-web-api-as-custom-api","status":"publish","type":"power-automate","link":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/power-automate\/custom-web-api-as-custom-api\/","title":{"rendered":"Guest Posts on using Web APIs as a Custom API in Microsoft Flow"},"content":{"rendered":"

With Custom APIs in Microsoft Flow, you can use from flow any custom actions you build as a developer. Gene Vangampelaere\u00a0has written a great blog post<\/a> on how to get started with a Web API and register that as a Custom API in a flow.\u00a0After you’ve followed the below tutorial, you can check out another post, by Tsuyoshi Matsuzaki, on how to set up Authentication for your Web API<\/a>. This covers both how to use Azure AD and Google authentication.<\/p>\n

Thanks to Gene and Tsuyoshi, on behalf of the Flow team! If anyone else has blog posts they would like to highlight, please let us know and we can highlight it on the blog.<\/p>\n

—-<\/p>\n

Use your custom WebApi with Microsoft Flow<\/h2>\n

Microsoft Flow is the new workflow engine from Microsoft. With flow you can create automated workflows between your favorite apps and services to get notifications, synchronize files, collect data, and more.<\/p>\n

You can find Microsoft Flow at: https:\/\/flow.microsoft.com<\/a><\/p>\n

Flow contains many predefined templates to use: https:\/\/flow.microsoft.com\/en-us\/templates\/<\/a>. Things like send reminders via the Flow mobile app to you phone when you get a mail or sync your Dropbox files with OneDrive, \u2026<\/p>\n

\"\"<\/p>\n

The real power of Microsoft flow is the fact that you can use you own services and extend your flows with custom data. In the following demo I will create a flow to send a notification email to users from a custom REST web service.<\/p>\n

To start I create a custom C# ASP.NET WebApi application in Visual Studio 2015. I called the application \u201cSwaggerDemo<\/a>\u201c.<\/p>\n

If you don\u2019t want to create it yourself, you can download the solution from my GitHub account<\/a>.<\/p>\n

\"\"<\/p>\n

The Api contains the following code:<\/p>\n

\"\"<\/p>\n

In the old days we created soap based web services that used WSDL to describe the service. Nowadays we use Swagger.io to do this. It is pretty easy to implement Swagger to an existing WebApi.<\/p>\n

Use NuGet to add the Swashbuckle<\/a> package to you project.<\/p>\n

\"\"<\/p>\n

To know more about this, check this page: https:\/\/devcenter.wintellect.com\/paulballard\/give-your-rest-apis-some-metadata-swagger<\/a>!<\/p>\n

When you run your project now you get to see the \u201cSwagger\u201d output:<\/p>\n

http:\/\/localhost:17406\/swagger\/<\/p>\n

\"\"<\/p>\n

Now you can deploy your server to a public webserver and we can start using it with Flow.<\/p>\n

To start using the Api we need to create a new service in Flow. Services are used to provide you the data and do operations.<\/p>\n

To add your custom API, go to the Flow dashboard via https:\/\/flow.microsoft.com<\/a> and click the settings icon in the top right corner:<\/p>\n

\"\"<\/p>\n

Select \u201cCustom API\u2019s\u201d and click the \u201cCreate custom API\u201d button in the next screen.<\/p>\n

To add an API you need a Swagger file, a JSON file that describes you service. To get the Swagger file for you WebApi go to https:\/\/editor.swagger.io<\/a>, click \u201cFile\u201d and \u201cImport URL\u2026\u201d. Enter the url of you webapi in the next screen.<\/p>\n

\"\"<\/p>\n

\"\"<\/p>\n

Click on \u201cImport\u201d.<\/p>\n

Now you click \u201cDownload JSON\u201d in the \u201cFile\u201d menu:<\/p>\n

\"\"<\/p>\n

Save that file because we\u2019ll need it in a moment.<\/p>\n

We go back to our Flow \u2013 Create Api screen and upload our Swagger JSON file and enter the details for our custom API:<\/p>\n

\"\"<\/p>\n

That is pretty much all we need to do to register our Api in Flow.<\/p>\n

No we can start creating our first custom flow in Microsoft Flow. Click on \u201cMy flows\u201d in the top menu bar and click on the \u201cCreate from blank\u201d button.<\/p>\n

Start with giving you flow a name on top of the screen and add the first action. I added the \u201cRecurrence\u201d action to run my flow every 10 minutes for example.<\/p>\n

\"\"<\/p>\n

In the next step I will call my custom service. Click on \u201cAdd action\u201d and select your service. Mine was called Swagger DEMO:<\/p>\n

\"\"<\/p>\n

You don\u2019t need to do a lot of things here. The API will be called and the results will be stored in a some variables that we will use in the next step.<\/p>\n

\"\"<\/p>\n

In this example I\u2019ll send an email to each user I get from the service. I use the \u201cApply to each\u201d action to iterate the results:<\/p>\n

\"\"<\/p>\n

The output of the REST call to my custom service is stored in the \u201cbody\u201d variable. The \u201cApply to each action will loop all the results and will execute each action in the container. I add a \u201cSend an email\u201d action to it.<\/p>\n

\"\"<\/p>\n

\"\"<\/p>\n

The Swagger file that I uploaded while creating my custom service will provide me the objects and properties that I can use in my action. In this example I get an email address and a name for each user that the service call returns.<\/p>\n

Now my flow is ready. All I need to do is save and publish it!<\/p>\n","protected":false},"excerpt":{"rendered":"

Guest blog post from Gene Vangampelaere, where you can seen how easy it is to build a Web API that you can then use as custom actions from inside of Microsoft Flow. <\/p>\n","protected":false},"author":347,"featured_media":0,"comment_status":"open","ping_status":"open","template":"","power-automate-category":[2546,2793],"power-automate-tag":[],"coauthors":[2913],"class_list":["post-110779","power-automate","type-power-automate","status-publish","hentry","power-automate-category-developers","power-automate-category-stories"],"yoast_head":"\nGuest Posts on using Web APIs as a Custom API in Microsoft Flow - Microsoft Power Platform Blog<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/power-automate\/custom-web-api-as-custom-api\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Guest Posts on using Web APIs as a Custom API in Microsoft Flow - Microsoft Power Platform Blog\" \/>\n<meta property=\"og:description\" content=\"Guest blog post from Gene Vangampelaere, where you can seen how easy it is to build a Web API that you can then use as custom actions from inside of Microsoft Flow.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/power-automate\/custom-web-api-as-custom-api\/\" \/>\n<meta property=\"og:site_name\" content=\"Microsoft Power Platform Blog\" \/>\n<meta property=\"og:image\" content=\"https:\/\/powerautomateblogmedia.azureedge.net\/powerautomateblog\/2016\/12\/1.jpg\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"3 min read\" \/>\n\t<meta name=\"twitter:label2\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data2\" content=\"Stephen Siciliano\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/power-automate\/custom-web-api-as-custom-api\/\",\"url\":\"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/power-automate\/custom-web-api-as-custom-api\/\",\"name\":\"Guest Posts on using Web APIs as a Custom API in Microsoft Flow - Microsoft Power Platform Blog\",\"isPartOf\":{\"@id\":\"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/power-automate\/custom-web-api-as-custom-api\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/power-automate\/custom-web-api-as-custom-api\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/powerautomateblogmedia.azureedge.net\/powerautomateblog\/2016\/12\/1.jpg\",\"datePublished\":\"2016-12-01T17:14:47+00:00\",\"dateModified\":\"2016-12-01T17:14:47+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/power-automate\/custom-web-api-as-custom-api\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/power-automate\/custom-web-api-as-custom-api\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/power-automate\/custom-web-api-as-custom-api\/#primaryimage\",\"url\":\"https:\/\/powerautomateblogmedia.azureedge.net\/powerautomateblog\/2016\/12\/1.jpg\",\"contentUrl\":\"https:\/\/powerautomateblogmedia.azureedge.net\/powerautomateblog\/2016\/12\/1.jpg\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/power-automate\/custom-web-api-as-custom-api\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Power Automate\",\"item\":\"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/power-automate\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Guest Posts on using Web APIs as a Custom API in Microsoft Flow\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/#website\",\"url\":\"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/\",\"name\":\"Microsoft Power Platform Blog\",\"description\":\"Innovate with Business Apps\",\"publisher\":{\"@id\":\"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/#organization\",\"name\":\"Microsoft Power Platform Blog\",\"url\":\"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/wp-content\/uploads\/2020\/03\/Microsoft-Logo-e1685482038800.png\",\"contentUrl\":\"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/wp-content\/uploads\/2020\/03\/Microsoft-Logo-e1685482038800.png\",\"width\":194,\"height\":145,\"caption\":\"Microsoft Power Platform Blog\"},\"image\":{\"@id\":\"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/#\/schema\/logo\/image\/\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Guest Posts on using Web APIs as a Custom API in Microsoft Flow - Microsoft Power Platform Blog","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/power-automate\/custom-web-api-as-custom-api\/","og_locale":"en_US","og_type":"article","og_title":"Guest Posts on using Web APIs as a Custom API in Microsoft Flow - Microsoft Power Platform Blog","og_description":"Guest blog post from Gene Vangampelaere, where you can seen how easy it is to build a Web API that you can then use as custom actions from inside of Microsoft Flow.","og_url":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/power-automate\/custom-web-api-as-custom-api\/","og_site_name":"Microsoft Power Platform Blog","og_image":[{"url":"https:\/\/powerautomateblogmedia.azureedge.net\/powerautomateblog\/2016\/12\/1.jpg","type":"","width":"","height":""}],"twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"3 min read","Written by":"Stephen Siciliano"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/power-automate\/custom-web-api-as-custom-api\/","url":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/power-automate\/custom-web-api-as-custom-api\/","name":"Guest Posts on using Web APIs as a Custom API in Microsoft Flow - Microsoft Power Platform Blog","isPartOf":{"@id":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/power-automate\/custom-web-api-as-custom-api\/#primaryimage"},"image":{"@id":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/power-automate\/custom-web-api-as-custom-api\/#primaryimage"},"thumbnailUrl":"https:\/\/powerautomateblogmedia.azureedge.net\/powerautomateblog\/2016\/12\/1.jpg","datePublished":"2016-12-01T17:14:47+00:00","dateModified":"2016-12-01T17:14:47+00:00","breadcrumb":{"@id":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/power-automate\/custom-web-api-as-custom-api\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/power-automate\/custom-web-api-as-custom-api\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/power-automate\/custom-web-api-as-custom-api\/#primaryimage","url":"https:\/\/powerautomateblogmedia.azureedge.net\/powerautomateblog\/2016\/12\/1.jpg","contentUrl":"https:\/\/powerautomateblogmedia.azureedge.net\/powerautomateblog\/2016\/12\/1.jpg"},{"@type":"BreadcrumbList","@id":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/power-automate\/custom-web-api-as-custom-api\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/"},{"@type":"ListItem","position":2,"name":"Power Automate","item":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/power-automate\/"},{"@type":"ListItem","position":3,"name":"Guest Posts on using Web APIs as a Custom API in Microsoft Flow"}]},{"@type":"WebSite","@id":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/#website","url":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/","name":"Microsoft Power Platform Blog","description":"Innovate with Business Apps","publisher":{"@id":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/#organization","name":"Microsoft Power Platform Blog","url":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/wp-content\/uploads\/2020\/03\/Microsoft-Logo-e1685482038800.png","contentUrl":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/wp-content\/uploads\/2020\/03\/Microsoft-Logo-e1685482038800.png","width":194,"height":145,"caption":"Microsoft Power Platform Blog"},"image":{"@id":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/#\/schema\/logo\/image\/"}}]}},"distributor_meta":false,"distributor_terms":false,"distributor_media":false,"distributor_original_site_name":"Microsoft Power Platform Blog","distributor_original_site_url":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog","push-errors":false,"_links":{"self":[{"href":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/wp-json\/wp\/v2\/power-automate\/110779"}],"collection":[{"href":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/wp-json\/wp\/v2\/power-automate"}],"about":[{"href":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/wp-json\/wp\/v2\/types\/power-automate"}],"author":[{"embeddable":true,"href":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/wp-json\/wp\/v2\/users\/347"}],"replies":[{"embeddable":true,"href":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/wp-json\/wp\/v2\/comments?post=110779"}],"version-history":[{"count":0,"href":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/wp-json\/wp\/v2\/power-automate\/110779\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/wp-json\/wp\/v2\/media?parent=110779"}],"wp:term":[{"taxonomy":"power-automate-category","embeddable":true,"href":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/wp-json\/wp\/v2\/power-automate-category?post=110779"},{"taxonomy":"power-automate-tag","embeddable":true,"href":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/wp-json\/wp\/v2\/power-automate-tag?post=110779"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/wp-json\/wp\/v2\/coauthors?post=110779"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}