requestErrorMessageToTargetAPI variable and the request is prevented from going to the backend.
Groovy Script
Sample Request
Explanation
This script performs the following operations:- Parsing JSON: Parses the incoming request body using
JsonSlurper. - Extracting Turkish ID Numbers: Extracts
requestingUserIdentityCardNoandrequestedIdentityCardNofields from JSON. - Validation: For each Turkish ID number:
- Length check (must be 11 characters)
- Mathematical algorithm validation (checking 9th and 10th digits)
- Error Management: If validation fails, an error message is assigned to the
requestErrorMessageToTargetAPIvariable and the request is not sent to the backend.
This script should be run on the request line (Request Policy) because it uses the
requestBodyTextFromClient variable.
