Redaction
The Redaction policy customizes the response according to any header, parameter or body field in the message returned from the Backend API or the values of these fields.
This means that if it is desired to change the response according to different user types, rules are defined with this policy instead of creating an API for each user.
It can be confused with the Business Rule as data transformation is done in the message. The differences between these two policies;
- The Business Rule policy is added to both the request line and the response line, while the Redaction policy is added to the response line only.
- While you can define actions (Add, Modify, Delete, Stop) directly in the Business Rule policy, actions (Modify, Delete) are defined when a certain field or value of a field is encountered in the Data Modification policy.
The picture below shows the policy settings:
The policy fields are shown in the table below.
Alan | Açıklama |
---|---|
Rule Sets | Rules that can be applied by Apinizer are added to the messages returned to Apinizer, and they are listed. |
Rule Creation
The rule is the criterion that tells you how to organize the response. On the other hand, action is the editing process to be done in the message when this criterion is met.
More than one action can be added to a rule. Message customization is done according to the given action sequence. Additionally, the policy may have more than one rule.
When an action is wanted to be added to the Policy by pressing the Add button, a screen like the following image will appear in front of the user:
The fields used for rule configuration are shown in the table below.
Alan | Açıklama |
---|---|
Redact By | Modification can be made according to different values to be selected from the sent message. |
Variable for rule set | A variable is chosen to access the item in the message. |
Values | If the correction method is selected as Variable value, this field becomes active. What values should be in the field selected with the variable should be written separately with commas. |
Action Definitions | Actions that can be applied in this table are listed in order of operation or a new one can be defined. |
Action Creation
When you want to add an action to the rule by pressing the Add button, the user will see a screen like the image below:
As seen in this image, 2 types of actions can be selected:
- Modify: The value of an existing field in the header, parameter or body of the request/response is changed.
- Delete: The value of an existing field or the entire field in the header, parameter or body of the request/response is deleted.
Modify Action
It is used to change the value in the header, parameter or body of the message.
When this action is selected, it is assumed that the value to be added in the message is included, if it is not found, the policy will fail. This should be noted in the conditional part of the rule.
The fields used for the edit action configuration are shown in the table below.
Field | Description |
---|---|
Modify Variable | The variable is selected to specify which element of the message to replace. |
Variable Data Type | Specifies which data type the variable value is in. The table below contains the details. |
Operator | Which operation will be applied on the data type is selected. The table below contains the details. |
Target Value Source Type | Selects where to get the value source.
|
Value | The value of the item to be changed is written. |
The value of the item to be changed is selected from the variable. |
The data type and operations of these data types can be:
Data Type | Operator | Description |
---|---|---|
Numeric | Add | It changes the value to be changed by adding the target value. |
Subtract | Changes the target value by deleting it from the value to be changed. | |
Multiply by | Multiplies the target value with the value to be changed. | |
Divide by | It changes the value to be changed by dividing the target value. | |
Mod | Changes the mode of the value to be changed according to the target value. | |
Power | It changes the value to be changed by taking the exponent of the target value. | |
String | Concat | Combines the target value to the end of the value to be changed. |
Decode Base64 | Replaces the value to be changed by subjecting it to Base64 decryption. | |
Encode Base64 | It changes the value to be changed by subjecting it to Base64 encryption. | |
Format | It masks the value with the properties specified in the javax.swing.text.MaskFormatter class. | |
Insert | Changes the target value by typing from the specified text index of the value to be changed. | |
Mask | Changes the value to be changed by masking all or the range specified by text indices. | |
Replace First | Replaces the first match of the specified replacement data in the value to be replaced with the target value. | |
Replace | Replaces all matches of the specified replacement data in the value to be replaced with the target value. | |
Replace With | It completely replaces the value to be changed with the target value. | |
Substring | It replaces the fields outside the specified text indexes of the value to be changed by deleting them. | |
Transform | It changes the value to be changed by subjecting it to XSLT or JOLT processing. | |
Trim | Removes leading and trailing spaces from the value to be changed. | |
Date/Trim | Add | Adds the specified time unit and amount to the value to be changed. |
Subtract | Deletes the specified time unit and amount to the value to be changed. |
Delete Action
It is used to delete the value in the header, parameter or body of the message.
When this action is selected, it is assumed that the value to be deleted is included in the message, if it is not found, the policy does not give an error, and other operations are continued.
The part of the message to be deleted is specified with the variable.
You can visit the Policies page for the details of the Conditions and Error Message Customization panels.