This article explores the example how we can add data to the existing data
Goal: we want to pull the post from this public API and maintain the data: https://jsonplaceholder.typicode.com/posts?userId=8
Create a new transformer: Connections -> transformers -> + for a new one
Data, transform data using mappers and conditions
Transformer: Merger Transformer (it takes another transformer’s input, so during a result both the resulting and initial data are kept)
Transformer: HTTP Transformer
Request URI: https://jsonplaceholder.typicode.com/posts?userId=8
Request method: get
Request Parameters: object:
{
"userId": "&{id}"
}
HTTP Client -> Default client
Template*:
{
"blog_posts": "&{@}"
}
To Filter Away other keys, and keep the ones we want:
List mapper -> key apccessor -> leave Root empty
Mappers: List: intersect keys
Array*:
{
"id": true,
"name": true,
"email": true,
"blog_posts": true
}
Now we want to get the name of the user to share on the blog post.
For this, add:
Transformer: Recursively copy values to children
Pattern to children within a parent:
blog_posts.*
(array that contains a lot of objects and we want to copy the value of each object of the blog_post key)
Mapping of values from parent to child:
{
"author": "&{name}"
}