Response Mapper rule
You can use this rule in the following use cases.
- Data normalization: This can be used to standardize the format of the data returned by the API, making it easier for clients to consume. For example, you could use a response transformation rule to convert all dates to a standard format, such as ISO 8601.
- Data security: This can be used to redact sensitive data from the response data, such as credit card numbers or social security numbers. For example, you could use a response transformation rule to replace all credit card numbers with asterisks or even hashing using encodings such as MD5SHA 256/512.
Requirements
- The endpoint output must be in a format that can be converted and parsed as some form of JSON.
Supported Content Encodings
Response Header Content-Encoding supported HTTP content encodings for decoding:
- compress
- br
- gzip
- deflate
Usage Guidelines
Always select Pass through if you plan to leave any Target paths field blank.
Starting in the October 2023 release, the Response Mapper and Response Transformer rules support the request and response functions in the APIM Expression Language. These functions enable you to modify the headers for your Proxy endpoints quickly. When you click experssions tab to enable the expression dropdown, you can access these functions.
Limitations
- If a Proxy endpoint uses a Triggered Task with an open document output view for the
response, the response will be a list, which requires that you index it by treating
'$'
as a list, such as'$[0]'
to access the first response document, or the only document (if only one is present). - If your incoming data is a list, Pass through is not supported.
Known Issues
APIM functions display in the expressions dropdown menu but do not actually work.
Field | Description |
---|---|
When this rule should be applied | An expression that defines one or more conditions that must be
true for the rule to execute.
Example: The expression |
Pass through |
This setting determines if data should be passed through or not. If you select this checkbox, then all the original input data is passed into the output document together with the data transformation results. If you deselect this checkbox, then only the data transformation results that are defined in the mapping section appear in the output document and the input data is discarded. Default value: Selected |
Mapping table | The mapping table consists of an Expression and Target field where you enter the mapping. The name for the API policy. |
Expression | The function to use to transform the data. For example, combine, concatenate or
flatten. Expressions that are evaluated replace the source targets at the end of the
Pipeline runtime. Example: $customer |
Target | The target JSON path where the value from the evaluated expression is written.
For example, after evaluation of the $person.firstname expression
the Snap inserts the firstname for the person
object. If left blank, the source path is deleted.Example: Customer |
Description | Use this rule to transform the API response body. Default value: Response body fields are being remapped as specified |