Changing the default messaging format

Last modified by Eva Torken on 2023/11/23 16:36

In our crash course on the API Gateway pattern, we have learned about setting up the API Gateway. By default, the messaging format chosen for your gateway is JSON. However, in some instances, other message formats are more appropriate as default. In this microlearning, we focus on changing the default message format and show the impact this has on flows in Create.

Should you have any questions, please contact academy@emagiz.com.

1. Prerequisites

  • Basic knowledge of the eMagiz platform

2. Key concepts

There are no specific concepts to consider for now that require additional explanation.

3. Changing the default messaging format

In our crash course on the API Gateway pattern, we have learned about setting up the API Gateway. By default, the messaging format selected for your gateway is JSON. However, the default messaging format can be changed in your project to for example, XML. This change can be made in Design -> Settings -> API Management. On the right side of this overview are the gateway settings. The last entry of this overview is the Default Format. By clicking on the Edit settings button, you enter the following overview

intermediate-api-management-changing-default-messaging-format--edit-settings.png

The last option allows you to switch between JSON or XML as your default messaging format in the gateway. In order to apply your new default to your project, you must press "Apply settings" in Design -> Architecture to confirm your change*.

* Note Changing the default messaging format does not affect existing operations in Create. Migrating these flows requires a reset of the exit flow. Additionally, the default response in Catalog has to be changed to application/xml. 

3.1 Impact in Create

After the flows are resetted in Create, the automatic flow creation in the Create phase is adapted to the new default setting. When changing the messaging format to XML, the components of newly generated flows are created with different names and settings. The image below shows an example of an API GET operation with XML as the default messaging format. Besides the changed naming of the transformation, no JSON factory support objects are required in your flow in comparison with a JSON messaging format.

intermediate-api-management-changing-default-messaging-format--get-operation.png

4. Key takeaways

  • The default messaging format can be changed to XML
  • Updating this only affects new flows
  • Migrating existing operations can be done by resetting the exit flow

5. Suggested Additional Readings

If you are interested in this topic and want more information on it, please read the help text provided by eMagiz.