Showing posts with label Logic App. Show all posts
Showing posts with label Logic App. Show all posts

Wednesday, 2 January 2019

Liquid Transformation As a Azure Function using DotLiquid

In this article, I would brief about achieving Liquid Template Transformation using DotLiquid in a Azure Function.

Using Azure SDK, I have create a simple HTTP Trigger function. This has two projects, LiquidTransformationApp(LiquidTransformation) and AzureFunctions.Helper.

In LiquidTransformation, we extract the request body, map name and map type from the query string and invoke utility helper for the transformation, as shown

Here is utility helper class with does the Parse and Render of the Liquid Template. I have embedded the liquid templates as as resource files and based on the MapName and MapType, we would dynamically execute the transformation and render the transformed result as HTTP Response to client. 

Here, we receive JSON request and JSON request would contain nested JObject/Array, thus to parse the JSON request as Dictionary Object, we use ParseJSONHelper and GenericInterface<T> and Generic<T> are used in Parse and Render stages of Liquid Templates to achieve support for dynamic objects.

Here are the Json To Json and Json To XML Transformation liquid templates.
Lets run and verify the Liquid Template Transformation

Sunday, 18 February 2018

Logic App | Integrating with Azure Function


In this article, I will integrate Azure Generic Webhook function with Logic App.

Lets create a generic webhook function and generate a code from json request as shown and use it the function.

This function validates the JSON input and renders response based on the unit provided.

Lets create Logic App and choose a blank template,as shown below.
 Bring in a HTTP Request,
 Using Sample JSON, we can generate the JSON schema and the configure the HTTP verb as post and provide the relative path
Once HTTP request is configured, we can add a new step and then choose an action and configure the Azure Function. Then pass in the HTTP body to function as shown.
Now, we can validate the response using condition and control the flow for true and false path.
Save the logic app and push message using PostMan tool and validate the behavior