Transformations in APIs
  • 23 Mar 2022
  • 1 Minute to read
  • Contributors
  • Comment
  • Dark
    Light
  • PDF

Transformations in APIs

  • Comment
  • Dark
    Light
  • PDF

In other Azure API Management tips, we discussed adding policies to your APIs. Policies you can add to operations when processing requests. When creating APIs as a gateway into your backend services, it is possible to transform your incoming request to another format and transform the request back to a format the caller understands. Moreover, you may use API Management as a façade in front of your Line-of-Business systems.

Within an inbound and outbound section of a policy, you can add policy statements such as convert to and from JSON to XML, or transform XML using XSLT. Furthermore, you can also transform from one JSON format to another using a liquid template by leveraging the set-body policy statement.

3(3)

Tip: Read the deep-dive blog post of the set-body policy by Mike Budzynski.

Transformations are an essential part of integration solutions, and instead of performing them in a Logic App leveraging an integration account, you can have the transformations inside a policy. Since you can apply XSLT on XML, you can perform some complex transformations. However, when it comes to complex transformations for JSON formats, you might want to delegate that somewhere else.

Lastly, there are a few other policy statements available Microsoft considers as transformation such as:

APIM.png


Was this article helpful?