Im new to TYK and I am wondering, is there a way to edit a response data with rich plugins?
Also, is it possible to remove any json which contains a certain key: value?
For example:
Removing all the jsons which contains a “classification”: “high” pair,
So the json:
{
“name”: “apple”,
“lastname”: “banana”,
“classification”: “low”,
“potato”: {
“foo”: “bar”,
“classification”: “high”
},
“raindeer”: {
“foo2”: “bar”,
“classification”: “low”
}
}
Wait a second, is the JSON always different? or is the classification always found in the same places?
If what you need to do is iteratively loop through all the fields and delete any that are called classification, then yes, you need a rich plugin to write that business logic.
But if you’re statically reshaping a known input/output, the Body Transform plugin is the best solution.
Yes, the data structure is unknown, all I need to do is iterate and remove jsons which contains Classification of some kind.
I read about body tranaformations and it doesnt answer my needs because the data structure is unknown.
I started using the python rich plugin but I didn’t know how to access the response data,
I have tried printing the response.raw_body but it seems it always empty, is there another attribute to response I can use to access the response data?