search cancel

API Gateway: Modify Response Bodies Question

book

Article ID: 190752

calendar_today

Updated On:

Products

CA API Gateway API SECURITY

Issue/Introduction

Does the CA API gateway support modification of response bodies?

One scenario is if a JSON response body contains HTML tags that match a set of tags, then perhaps the gateway could remove those tags from the body and allow the modified response to return to the caller.

1. Is this supported this out of the box and does it allow custom logic to be used for modifying responses?

2. If so, does documentation exist explaining how to do such?

Environment

API Gateway: 9.4

Resolution

Out of the box, we don't have the ability to modify the body of a response. We have a few assertions that can do some message transformations but if you are trying to do something (like in your example), you would have to set up the logic. You could probably do something like:

1. Read response into a context variable
2. Use the Evaluate Regular Expressions assertion to find the HTML pattern
3. Call the context variable

A very simple HTML sample policy has been attached.

Attachments

1589392166674__modifyHTML.xml get_app