Groovy Script
Explanation
This script performs the following operations:- Parsing JSON Response: Parses the JSON response coming from REST service using
JsonSlurper. - Data Extraction: Extracts name and surname information from JSON structure.
- Control and Conversion:
- If name information is empty or null, returns an empty JSON response with HTTP 503 status code.
- If name information exists, returns a JSON response containing only name and surname information.
Usage Scenario
This script processes the response from identity verification service:- Returns error code in case of empty response
- Filters and returns only necessary fields in case of valid response
This script should be run on the response line (Response Policy) because it uses the
responseBodyTextToClient variable.
