Implementing a Groovy policy for an API response

The API response can also work with a Groovy script. However, the objects which can be manipulated as the earlier diagram is shown are different. Rather than APIRequest, the entity will be APIResponse, correspondingly ServiceRequest is now ServiceResponse.

While the API platform offers a redaction policy it maybe more desirable to use Groovy to manipulate the response and mask values by replacing the specific with xxx for example. This is something commonly seen in websites handling credit cards. Using the same test framework for manipulating headers and the test tool, the response previously shown can be changed and have the x-b3-traceid masked out, using the following Groovy script:

// get ...

Get Implementing Oracle API Platform Cloud Service now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.