Expand entity data with the HTTP transformer

User guide on how to use the HTTP transformer to expand entity data.

This article explains how to create a transformer that expands current entity data with data from a HTTP call.

In this scenario product data needs to be expanded with supplier data into one entity. The product data looks as follows.

Screenshot from 2020-10-16 09-35-05

First, select the "Chain" prototype. With this prototype multiple transform steps can be performed. A new property called "supplier" needs to be created. All data from the HTTP call will be placed here.



Create a new "supplier" node

The "List inherit from supplied data" transformer is used to expand entity data with new data.

In this example the "supplier" node is added to the root of the entity data.

This is done by creating a "Data, transform data using mappers and conditions" transformer. A "List mapper" is added to perform transform actions involving a list.

The "Pattern accessor" is used to target the root of the entity data.

A new property called "supplier" is added with the "List inherit from supplied data" transformer. It adds a new property with an empty object as value.

New Project (7)

 


Data that is needed to perform the API call needs to be copied over to the "supplier" property. In our example only the product identifier is needed.

 

Copy product identifier

The "copy using a pattern" transformer is added to the data transformer.

The pattern to the product identifier is added as the pattern.

The identifier is then copied into the supplier node. 

New Project (8)

 

The "Node, transform nodes" transformer is added to the "Chain" transformer. This is used to perform transform actions only on the "supplier" node. The "HTTP transformer" is added to perform an HTTP call and to expand the "supplier" node with all received data.



Add a HTTP transformer

The "Node, transform nodes" transformer is added.

The "Pattern accessor" is used to target only the "supplier" node.

The "HTTP Transformer" is added. In this example an API testing service is used as URL.

The product identifier is added to the URL by using a placeholder. It contains the path to the identifier. Note that only data within the supplier property is available within the node transformer.

 

New Project (9)

 

The final result is shown below. The "product" node still contains the original entity data. The "supplier" node is now expanded with data from the API call.

Screenshot from 2020-10-16 10-12-34