Using the IBM Optim Data Privacy for z/OS API to apply advanced masking
The IBM® Optim Data Privacy for z/OS® advanced masking API enables you to apply masking policies to data values and return masked values. You can use this capability for advanced masking methods such as format-preserving encryption and tokenization, ensuring data privacy while maintaining usability.
POST /optim/v1/masking/text/processThe masking API accepts:
- A masking policy that defines the masking method and format.
- A payload containing input values to be masked.
The IBM Optim Data Privacy for z/OS API returns masked values in the response.
Request body structure
The POST body is a JSON object that includes the following objects:
policy-
The
policyobject specifies the processor type (masking method) and format.- The processor type defines the masking method. Different processors have different
behaviors, such as input validation and repeatability. The processor type is defined in
policy.processors[0].type. - The format specifies the domain of values, such as government identification numbers or
credit card numbers. The format is required for some processors. The format is defined in
policy.processors[0].configuration.format.
- The processor type defines the masking method. Different processors have different
behaviors, such as input validation and repeatability. The processor type is defined in
payload-
The
payloadobject contains an array of input values to be masked.- Optional fields:
iv: Initialization vector (seed for value generation).key: Encryption key (required for certain processors).
- Optional fields:
Processor requirements
- Processors that require
configuration.format -
FormatPreservingRedactionProcessorRandomFormatFabricationProcessorRepeatableNoiseProcessorRandomNoiseProcessor
- Processors that require
"iv"in the top-level JSON -
EncryptionProcessorFormatPreservingEncryptionProcessorFormatPreservingTokenizationProcessorRepeatableFormatFabricationProcessorRepeatableNoiseProcessorTokenizationProcessor
- Processors that require ""key" in the top-level JSON
-
EncryptionProcessorFormatPreservingEncryptionProcessor
- Processors that require
"mode": "tokenize"in configuration -
FormatPreservingTokenizationProcessorTokenizationProcessor
- Processors that require
"mode": "encrypt"in configuration -
EncryptionProcessorFormatPreservingEncryptionProcessor
- Processors that require
"millipercent"in configuration -
RandomNoiseProcessorRepeatableNoiseProcessor
Example request and response
Use the sample requests and responses in this section to help you work with the API.
- Example input file
-
Here are the contents of the sample input file mask1.json that will be used in this example scenario.
{ "policy": { "version": "1.0", "graph": { "nodes": [ { "id": "FPT", "root": true } ], "edges": [] }, "processors": [ { "id": "FPT", "type": "FormatPreservingTokenizationProcessor", "configuration": { "format": "Countries_CaseSensitive", "mode": "tokenize" }, "loggable": true } ], "selectors": [], "expressions": [], "formats": [] }, "iv": "b6dd4a74115729165b063d823b0275a85054f6db7d252dd5ff4dd2278e3268a8", "payload": ["Albania", "Chile"] } - Example request (curl)
-
Here is the sample request command:
curl -skX POST https://localhost:7725/optim/v1/masking/text/process \ -H "Content-Type: application/json" \ -H "Authorization: Bearer $TOKEN" \ -d @mask1.json - Example response
- Here is the sample response from the IBM Optim Data Privacy for z/OS masking
API:
{ "_statusCode_": 200, "message": "Get masked text successful", "messageID": "OPTTC0601I", "requestObj": [ "Маршалловы Острова", "澤西" ] } - Explanation of the response
-
The response masked the values provided in the input JSON. Here are the relevant details:
- Processor
-
FormatPreservingTokenizationProcessorvalidated the input and generated repeatable masked values. - Format
-
Countries_CaseSensitivedefined the valid domain (country names). - iv
-
Contained the seed that was used for value generation.
- Payload
-
The results of the masking:
Albania→Маршалловы ОстроваChile→澤西