Image for post
Image for post

Rescuing Your REST API Data With Azure Logic Apps

Its Codeless, Its Serverless and It Scales Automatically

Did you ever realize how REST APIs cant really be relied on to retain all your data?

Creating the Data Lake to Hold the Messages

First we need to create our data lake. Here is a Microsoft video showcasing just that. Go ahead and follow it to set up your data lake.

Create a New Container and Name It “Apimessages”

In your data lake you need a folder to be the root folder for all messages.

Image for post
Image for post

Creating the Logic App

Add a HTTP step to your Logic App and give it a placeholder Schema like below. The HTTP POST URL you will use later to put in the API Policy to tell the API manager where to send the messages.

Image for post
Image for post
Image for post
Image for post
Image for post
Image for post
Image for post
Image for post
Image for post
Image for post
Image for post
Image for post
Image for post
Image for post
Image for post
Image for post
Image for post
Image for post

Connecting Your API to the Message Store Logic App

In order to capture the messages coming in we will use API Manager Policies. This policy will send the messages to our Logic App every time a message is received on the API.

Be sure to put it between the inbound tags as shown here

<inbound>
<base />
<send-one-way-request mode=”new”>
<set-url>@(“https://the address found in your logic app http call window</set-url>
<set-method>POST</set-method>
<set-header name=”blobpath” exists-action=”override”><value>orderservice/neworder</value>
</set-header>
<set-body>@(context.Request.Body.As<string>(preserveContent: true))</set-body>
</send-one-way-request>
<set-variable name=”bodystored” value=”@(context.Request.Body.As<string>(preserveContent: true))” /></inbound>

Message Secure

Sit back and watch your data being safely stored. The API policy will create subfolders for each api and save the messages inside.

Image for post
Image for post
Image for post
Image for post

Stay tuned for part 2: “Keeping Track of Those Failed API Messages”

We will see how to easily keep track of failed versus successful messages so that all failed messages are put in one folder for review and reprocessing.

Written by

Working with computers and following health for life.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store