Mask URLs with a transformation policy

Organizations might need to adjust the information that an API publishes at short notice. For example, to comply with a change of legislation or address a new security threat.

The Census API example exposes details about the URL from which the API is being called. This information could allow a malicious user to attempt to access the census data by bypassing the API Management gateway and exposing a less secure endpoint. As lead developer, you want to mask these URLs within the response body of the API.

Here, you learn how to use API Management policies that manipulate the content of API response headers and bodies.

Why transform a response?

The response body of an API call contains the data that is being requested. In the Census API, for example, the response body contains the JSON data for the respondents. You can also see how the body contains URL links to view individual people:

Screenshot of a default HTTP response with the href value highlighted, showing an unmasked URL link.

These links are based on the Census API endpoints and need to be masked to show the API Management URLs instead.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *