Using Liquid filters in APIManagement to transform messages whitepaper

Using Liquid filters in APIManagement to transform messages whitepaper

Those who know me and follow me are used to seeing me publishing several resources, including whitepapers. But this one is different! Typically, when it comes to whitepapers or books, I usually release them in BizTalk360 or Serveless360, a partnership that I have since many years, and you should expect to find it more in the future. However, this is the first whitepaper I have published under the DevScope umbrella, and I could be so proud of the result.

Note: not only I’m proud of the end result of this whitepaper, which I personally find this information very useful, but I’m also in love with my new corporate photo!

I typically write about “stuff” I work on daily bases, and for the past months, I have been working a lot with Liquid Template to perform transformations on API Management. Liquid is an open-source template language created by Shopify and written in Ruby. It is the backbone of Shopify themes and is used to load dynamic content on storefronts. However, Azure API Management uses a subset of Liquid templating language to transform the body of a request or response: DotLiquid

If it is true that we can find excellent Shopify documentation, the same may not be that simple for DotLiquid, and I struggle a little to get decent examples of how to use Liquid Filters in API Management, and that was the main reason why I decided to write this whitepaper.

What is DotLiquid?

DotLiquid is a deviation from Shopify’s original liquid template language. It is a .Net port of the popular Shopify’s Liquid templating language. It is a separate project that aims to retain the same template syntax as the original while using .NET coding conventions where possible. However, they are not entirely the same. In some cases, they have different behaviors.

Liquid uses a combination of objects, tags, and filters inside template files to display dynamic content.

Where:

  • Objects contain the content that Liquid displays on a page. Objects and variables are displayed when enclosed in double curly braces: {{ and }}.
Hi my name is {{ author.name }}
  • Tags create the logic and control flow for templates. The curly brace percentage delimiters {% and %} and the text that they surround do not produce any visible output when the template is rendered. This lets you assign variables and create conditions or loops without showing any of the Liquid logic on the page.
{% if author %}
 Hi my name is {{ author.name }}!
{% endif %}
  • Filters change the output of a Liquid object or variable. They are used within double curly braces {{ }} and variable assignment and are separated by a pipe character |.
{{ "Sandro" | Append: " Pereira" }}

In this whitepaper, I’m going to focus on the DotLiquid Filters you can use on API Management to transform the body of a request or response.

What is a liquid filter?

As mentioned above, Filters change the output of a Liquid object or variable. They are used within double curly braces {{ }} and variable assignment and are separated by a pipe character |. They are like functions in C# code or Functoids in BizTalk Server maps.

If we apply, for example, the Append filter like:                                                              

{% assign myvariable = "Sandro" %}
{{ myvariable | Append: " Pereira" }}   

The end result will be: Sandro Pereira

We can also apply multiple filters on one output which are applied from left to right. Like a PowerShell pipeline. A PowerShell pipeline is a series of commands connected by pipeline operators (|). Each pipeline operator sends the results of the preceding command to the next command. Filters use the same concept. For example:

"Name": "{{ "Sandro Pereira" | Split: " " | Last }}"

The end result here will be: “Name”: “Pereira”

Download

You can see the official release announcement here: Download Sandro Pereira’s whitepaper on Liquid Filters.

You can download, for free, the Using Liquid filters in APIManagement to transform messages whitepaper here:

Hope you find this useful! So, if you liked the content or found it useful and want to help me write more content, you can buy (or help buy) my son a Star Wars Lego! ?

Author: Sandro Pereira

Sandro Pereira lives in Portugal and works as a consultant at DevScope. In the past years, he has been working on implementing Integration scenarios both on-premises and cloud for various clients, each with different scenarios from a technical point of view, size, and criticality, using Microsoft Azure, Microsoft BizTalk Server and different technologies like AS2, EDI, RosettaNet, SAP, TIBCO etc.

He is a regular blogger, international speaker, and technical reviewer of several BizTalk books all focused on Integration. He is also the author of the book “BizTalk Mapping Patterns & Best Practices”. He has been awarded MVP since 2011 for his contributions to the integration community.

BizTalk Server 2020 – 20 days, 20 posts: BizTalk Filter Finder Tool for BizTalk Server 2020

BizTalk Server 2020 – 20 days, 20 posts: BizTalk Filter Finder Tool for BizTalk Server 2020

BizTalk Server 2020 – 20 days, 20 posts – day 4. Again a bit behind on this post, I need to recover the missing days but I will get there. Today I have chosen to migrate another productivity tool that I use often especially when I’m working with pure pub-sub solutions: BizTalk Filter Finder Tool to be compatible with BizTalk Server 2020. I hope you enjoy and find this tool useful.

BizTalk Filter Finder Tool

BizTalk Filter Finder Tool is a simple tool that aims to simplify the process for better understand and maintain solutions based on pub-sub and content-based routing. By allowing you to have a quick overview of all the artifacts, send ports or orchestrations that have filters associated.

This tool will extend default BizTalk Server capabilities transforming this tedious and sometimes complicate analyze a little simple, easy and fast.

BizTalk Filter Finder Tool

This tool will extend default BizTalk Server capabilities transforming this tedious and sometimes complicate analysis a little simple, easy and fast. You can read more details about this tool in the original post here: BizTalk Filter Finder Tool.

Other versions

This tool is also available for the following BizTalk Server versions:

Download

You can download BizTalk Filter Finder Tool from:
BizTalk Filter Finder ToolBizTalk Filter Finder Tool
GitHub

The post BizTalk Server 2020 – 20 days, 20 posts: BizTalk Filter Finder Tool for BizTalk Server 2020 appeared first on SANDRO PEREIRA BIZTALK BLOG.

BizTalk Filter Finder Tool for BizTalk Server 2013 R2

BizTalk Filter Finder Tool for BizTalk Server 2013 R2

Recently my team and I developed and released several tools that extend the out-of-box capabilities of BizTalk Server 2016 for developer and administration teams to be more productive, saving times in some simple but time-consuming tasks that should d supposed to be. One of these tools was BizTalk Filter Finder Tool.

Because many clients still are using BizTalk Server 2013 R2, and because I had received some requests from the community, I will be releasing these tools for BizTalk Server 2013 R2 also. And today, we will stat with the BizTalk Filter Finder Tool.

BizTalk Filter Finder Tool

BizTalk Filter Finder Tool is a simple tool that aims to simplify the process for better understand and maintain solutions based on content-based routing. By allowing you to have a quick overview of all the artifacts, send ports or orchestrations that have filters associated.

BizTalk Filter Finder Tool

This tool will extend default BizTalk Server capabilities transforming this tedious and sometimes complicate analyze a little simple, easy, and fast.

It way not be a fantastic tool; it may not be beautiful, but for me is a timesaver tool.

Credits also to my team member at DevScope, Pedro Almeida that collaborated with me in the development of this tool.

Download

You can download BizTalk Filter Finder Tool from:
BizTalk Filter Finder ToolBizTalk Filter Finder Tool
GitHub

The post BizTalk Filter Finder Tool for BizTalk Server 2013 R2 appeared first on SANDRO PEREIRA BIZTALK BLOG.